Commit 1d356539 authored by Felipe Andrade's avatar Felipe Andrade

revert cache.go

parent f8013936
...@@ -12,7 +12,6 @@ import ( ...@@ -12,7 +12,6 @@ import (
type Cache interface { type Cache interface {
Get(ctx context.Context, key string) (string, error) Get(ctx context.Context, key string) (string, error)
Put(ctx context.Context, key string, value string) error Put(ctx context.Context, key string, value string) error
Clear(ctx context.Context) error
} }
const ( const (
...@@ -43,11 +42,6 @@ func (c *cache) Put(ctx context.Context, key string, value string) error { ...@@ -43,11 +42,6 @@ func (c *cache) Put(ctx context.Context, key string, value string) error {
return nil return nil
} }
func (c *cache) Clear(ctx context.Context) error {
c.lru.Purge()
return nil
}
type redisCache struct { type redisCache struct {
rdb *redis.Client rdb *redis.Client
} }
...@@ -81,29 +75,6 @@ func (c *redisCache) Put(ctx context.Context, key string, value string) error { ...@@ -81,29 +75,6 @@ func (c *redisCache) Put(ctx context.Context, key string, value string) error {
return err return err
} }
func (c *redisCache) Clear(ctx context.Context) error {
patterns := []string{"lvc:*", "method:*"}
for _, p := range patterns {
scmd := c.rdb.Keys(ctx, p)
err := scmd.Err()
if err != nil {
RecordRedisError("CacheClear")
return err
}
keys, _ := scmd.Result()
icmd := c.rdb.Del(ctx, keys...)
err = icmd.Err()
if err != nil {
RecordRedisError("CacheClear")
return err
}
}
return nil
}
type cacheWithCompression struct { type cacheWithCompression struct {
cache Cache cache Cache
} }
...@@ -132,10 +103,6 @@ func (c *cacheWithCompression) Put(ctx context.Context, key string, value string ...@@ -132,10 +103,6 @@ func (c *cacheWithCompression) Put(ctx context.Context, key string, value string
return c.cache.Put(ctx, key, string(encodedVal)) return c.cache.Put(ctx, key, string(encodedVal))
} }
func (c *cacheWithCompression) Clear(ctx context.Context) error {
return c.cache.Clear(ctx)
}
type GetLatestBlockNumFn func(ctx context.Context) (uint64, error) type GetLatestBlockNumFn func(ctx context.Context) (uint64, error)
type GetLatestGasPriceFn func(ctx context.Context) (uint64, error) type GetLatestGasPriceFn func(ctx context.Context) (uint64, error)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment