mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
Updating ltcache with groups support
This commit is contained in:
2
cache/cache.go
vendored
2
cache/cache.go
vendored
@@ -107,7 +107,7 @@ func Set(key string, value interface{}, commit bool, transID string) {
|
||||
cacheMux.Lock()
|
||||
defer cacheMux.Unlock()
|
||||
}
|
||||
cache.Put(key, value)
|
||||
cache.Put(key, value, nil)
|
||||
//log.Println("ADD: ", key)
|
||||
} else {
|
||||
transBufMux.Lock()
|
||||
|
||||
9
cache/cache_store.go
vendored
9
cache/cache_store.go
vendored
@@ -27,7 +27,7 @@ import (
|
||||
)
|
||||
|
||||
type cacheStore interface {
|
||||
Put(string, interface{})
|
||||
Put(string, interface{}, []string)
|
||||
Get(string) (interface{}, bool)
|
||||
Delete(string)
|
||||
DeletePrefix(string)
|
||||
@@ -64,8 +64,8 @@ func (cs cacheLRUTTL) cacheInstance(instID string) (c *ltcache.Cache) {
|
||||
return
|
||||
}
|
||||
|
||||
func (cs cacheLRUTTL) Put(key string, value interface{}) {
|
||||
cs.cacheInstance(key[:PREFIX_LEN]).Set(key[PREFIX_LEN:], value)
|
||||
func (cs cacheLRUTTL) Put(key string, value interface{}, grpIDs []string) {
|
||||
cs.cacheInstance(key[:PREFIX_LEN]).Set(key[PREFIX_LEN:], value, grpIDs)
|
||||
}
|
||||
|
||||
func (cs cacheLRUTTL) Get(key string) (interface{}, bool) {
|
||||
@@ -92,8 +92,7 @@ func (cs cacheLRUTTL) CountEntriesForPrefix(prefix string) (cnt int) {
|
||||
func (cs cacheLRUTTL) GetKeysForPrefix(prefix string) (keys []string) {
|
||||
prefix, key := prefix[:PREFIX_LEN], prefix[PREFIX_LEN:]
|
||||
if c, ok := cs[prefix]; ok {
|
||||
for _, ifKey := range c.Keys() {
|
||||
iterKey := ifKey.(string)
|
||||
for _, iterKey := range c.Items() {
|
||||
if len(key) == 0 || strings.HasPrefix(iterKey, key) {
|
||||
keys = append(keys, prefix+iterKey)
|
||||
}
|
||||
|
||||
2
glide.lock
generated
2
glide.lock
generated
@@ -16,7 +16,7 @@ imports:
|
||||
- name: github.com/cgrates/kamevapi
|
||||
version: e4dfe7d6cb5bb0872111fe7d61af0e1a19eda485
|
||||
- name: github.com/cgrates/ltcache
|
||||
version: 74beef0471a1e04ec8c95b5459086a9308dfff84
|
||||
version: e96891e9c23f8b15dfd5bfbb22ac05aacaf83860
|
||||
- name: github.com/cgrates/osipsdagram
|
||||
version: 3d6beed663452471dec3ca194137a30d379d9e8f
|
||||
- name: github.com/cgrates/radigo
|
||||
|
||||
Reference in New Issue
Block a user