Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* context * add context cache feature * remove global context cache * remove global context cache * reset statment * fix bug * remove unused params * refactor ContextCache * refactor ContextCache * update README * disable global cache on context cache test
- Loading branch information
Showing
7 changed files
with
162 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2018 The Xorm Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
package xorm | ||
|
||
// ContextCache is the interface that operates the cache data. | ||
type ContextCache interface { | ||
// Put puts value into cache with key. | ||
Put(key string, val interface{}) | ||
// Get gets cached value by given key. | ||
Get(key string) 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] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters