MCPcopy
hub / github.com/apache/answer / getSession

Method getSession

plugin/kv_storage.go:84–96  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

82}
83
84func (kv *KVOperator) getSession(ctx context.Context) (*xorm.Session, func()) {
85 session := kv.session
86 cleanup := func() {}
87 if session == nil {
88 session = kv.data.DB.NewSession().Context(ctx)
89 cleanup = func() {
90 if session != nil {
91 _ = session.Close()
92 }
93 }
94 }
95 return session, cleanup
96}
97
98func (kv *KVOperator) getCacheKey(params KVParams) string {
99 return fmt.Sprintf("plugin_kv_storage:%s:group:%s:key:%s", kv.pluginSlugName, params.Group, params.Key)

Callers 4

GetMethod · 0.95
SetMethod · 0.95
DelMethod · 0.95
GetByGroupMethod · 0.95

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected