1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

move internal/abi_cache to abi

This commit is contained in:
Henrik Hautakoski 2023-01-12 16:48:04 +01:00
parent c05b789269
commit 92c605c7fa
3 changed files with 7 additions and 8 deletions

View file

@ -1,4 +1,4 @@
package abi_cache
package abi
import (
"context"
@ -14,7 +14,7 @@ type Cache struct {
prefix string
}
func New(prefix string, options *redis_cache.Options) *Cache {
func NewCache(prefix string, options *redis_cache.Options) *Cache {
return &Cache{
c: redis_cache.New(options),
ctx: context.Background(),

View file

@ -1,4 +1,4 @@
package abi_cache
package abi
import (
"strings"
@ -73,7 +73,7 @@ var abiString = `
`
func TestGetSet(t *testing.T) {
c := New("abi.cache.test", &redis_cache.Options{
c := NewCache("abi.cache.test", &redis_cache.Options{
Redis: redis.NewClient(&redis.Options{}),
// Cache 10k keys for 1 minute.
LocalCache: redis_cache.NewTinyLFU(10000, time.Minute),
@ -139,7 +139,7 @@ func TestGetSet(t *testing.T) {
}
func TestCacheMiss(t *testing.T) {
c := New("abi.cache.test", &redis_cache.Options{
c := NewCache("abi.cache.test", &redis_cache.Options{
Redis: redis.NewClient(&redis.Options{}),
// Cache 10k keys for 1 minute.
LocalCache: redis_cache.NewTinyLFU(10000, time.Minute),

View file

@ -5,7 +5,6 @@ import (
"fmt"
"time"
"eosio-ship-trace-reader/internal/abi_cache"
"eosio-ship-trace-reader/internal/redis"
eos "github.com/eoscanada/eos-go"
@ -13,14 +12,14 @@ import (
)
type AbiManager struct {
cache *abi_cache.Cache
cache *Cache
api *eos.API
ctx context.Context
}
func NewAbiManager(api *eos.API, id string) *AbiManager {
// Init abi cache
cache := abi_cache.New("ship.cache."+id+".abi", &redis_cache.Options{
cache := NewCache("ship.cache."+id+".abi", &redis_cache.Options{
Redis: redis.Client(),
// Cache 10k keys for 10 minutes.
LocalCache: redis_cache.NewTinyLFU(10000, 10*time.Minute),