From b495fa5ad0099b672a52d196c2b993d45a3fee00 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 23 Sep 2018 10:18:40 +0800 Subject: [PATCH] refactor ContextCache --- context_cache.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/context_cache.go b/context_cache.go index cfe4f17f..1bc22884 100644 --- a/context_cache.go +++ b/context_cache.go @@ -6,7 +6,7 @@ package xorm // ContextCache is the interface that operates the cache data. type ContextCache interface { - // Put puts value into cache with key and expire time. + // Put puts value into cache with key. Put(key string, val interface{}) // Get gets cached value by given key. Get(key string) interface{} @@ -14,14 +14,17 @@ type ContextCache interface { type memoryContextCache map[string]interface{} +// NewMemoryContextCache return memoryContextCache func NewMemoryContextCache() memoryContextCache { return make(map[string]interface{}) } +// Put puts value into cache with key. func (m memoryContextCache) Put(key string, val interface{}) { m[key] = val } +// Get gets cached value by given key. func (m memoryContextCache) Get(key string) interface{} { return m[key] }