(ctx context.Context)
| 82 | } |
| 83 | |
| 84 | func (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 | |
| 98 | func (kv *KVOperator) getCacheKey(params KVParams) string { |
| 99 | return fmt.Sprintf("plugin_kv_storage:%s:group:%s:key:%s", kv.pluginSlugName, params.Group, params.Key) |
no test coverage detected