1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-07-03 11:53:41 +02:00

app/abi/cache.go: in key() change separator to "::"

This commit is contained in:
Henrik Hautakoski 2023-07-13 07:02:29 +02:00
parent e377942d23
commit 62f898f38c
2 changed files with 4 additions and 4 deletions

View file

@ -38,5 +38,5 @@ func (cache *Cache) Set(account string, abi *eos.ABI, ttl time.Duration) error {
} }
func (cache *Cache) key(account string) string { func (cache *Cache) key(account string) string {
return cache.prefix + "." + account return cache.prefix + "::" + account
} }

View file

@ -75,7 +75,7 @@ var abiString = `
func TestGetSet(t *testing.T) { func TestGetSet(t *testing.T) {
client, mock := redismock.NewClientMock() client, mock := redismock.NewClientMock()
c := NewCache("abi.cache.test", &redis_cache.Options{ c := NewCache("thalos::cache::test", &redis_cache.Options{
Redis: client, Redis: client,
// Cache 10k keys for 1 minute. // Cache 10k keys for 1 minute.
LocalCache: redis_cache.NewTinyLFU(10000, time.Minute), LocalCache: redis_cache.NewTinyLFU(10000, time.Minute),
@ -86,7 +86,7 @@ func TestGetSet(t *testing.T) {
bytes, _ := c.c.Marshal(*abi) bytes, _ := c.c.Marshal(*abi)
mock.ExpectSet("abi.cache.test.testaccount", bytes, time.Minute).SetVal("OK") mock.ExpectSet("thalos::cache::test::testaccount", bytes, time.Minute).SetVal("OK")
err = c.Set("testaccount", abi, time.Minute) err = c.Set("testaccount", abi, time.Minute)
assert.NoError(t, err) assert.NoError(t, err)
@ -147,7 +147,7 @@ func TestGetSet(t *testing.T) {
func TestCacheMiss(t *testing.T) { func TestCacheMiss(t *testing.T) {
client, _ := redismock.NewClientMock() client, _ := redismock.NewClientMock()
c := NewCache("abi.cache.test", &redis_cache.Options{ c := NewCache("thalos::cache::test", &redis_cache.Options{
Redis: client, Redis: client,
// Cache 10k keys for 1 minute. // Cache 10k keys for 1 minute.
LocalCache: redis_cache.NewTinyLFU(10000, time.Minute), LocalCache: redis_cache.NewTinyLFU(10000, time.Minute),