Documentation
¶
Index ¶
- Variables
- type FreecacheRepository
- func (c *FreecacheRepository) Clear(_ context.Context) error
- func (c *FreecacheRepository) Delete(_ context.Context, key string) error
- func (c *FreecacheRepository) Exists(_ context.Context, key string) bool
- func (c *FreecacheRepository) Get(_ context.Context, key string, dst any) error
- func (c *FreecacheRepository) Set(_ context.Context, key string, value any, ttl time.Duration) error
- func (c *FreecacheRepository) TTL(_ context.Context, key string) (time.Duration, error)
- func (c *FreecacheRepository) Touch(_ context.Context, key string, ttl time.Duration) error
- type GoCacheRepository
- func (c *GoCacheRepository) Clear(_ context.Context) error
- func (c *GoCacheRepository) Delete(_ context.Context, key string) error
- func (c *GoCacheRepository) Exists(_ context.Context, key string) bool
- func (c *GoCacheRepository) Get(_ context.Context, key string, dst any) error
- func (c *GoCacheRepository) Set(_ context.Context, key string, value any, ttl time.Duration) error
- func (c *GoCacheRepository) TTL(_ context.Context, key string) (time.Duration, error)
- func (c *GoCacheRepository) Touch(_ context.Context, key string, ttl time.Duration) error
- type GoRedisRepository
- func (c *GoRedisRepository) Clear(ctx context.Context) error
- func (c *GoRedisRepository) Delete(ctx context.Context, key string) error
- func (c *GoRedisRepository) Exists(ctx context.Context, key string) bool
- func (c *GoRedisRepository) Get(ctx context.Context, key string, dst any) error
- func (c *GoRedisRepository) Set(ctx context.Context, key string, value any, ttl time.Duration) error
- func (c *GoRedisRepository) TTL(ctx context.Context, key string) (time.Duration, error)
- func (c *GoRedisRepository) Touch(ctx context.Context, key string, ttl time.Duration) error
- type ICacheRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCacheNotFound = errors.New("cache: key not found")
Functions ¶
This section is empty.
Types ¶
type FreecacheRepository ¶
func (*FreecacheRepository) Delete ¶
func (c *FreecacheRepository) Delete(_ context.Context, key string) error
func (*FreecacheRepository) Exists ¶
func (c *FreecacheRepository) Exists(_ context.Context, key string) bool
type GoCacheRepository ¶
func (*GoCacheRepository) Delete ¶
func (c *GoCacheRepository) Delete(_ context.Context, key string) error
func (*GoCacheRepository) Exists ¶
func (c *GoCacheRepository) Exists(_ context.Context, key string) bool
type GoRedisRepository ¶
type GoRedisRepository struct {
RDB *redis.Client
Logger *log.Logger
// contains filtered or unexported fields
}
func (*GoRedisRepository) Delete ¶
func (c *GoRedisRepository) Delete(ctx context.Context, key string) error
func (*GoRedisRepository) Exists ¶
func (c *GoRedisRepository) Exists(ctx context.Context, key string) bool
type ICacheRepository ¶
type ICacheRepository interface {
Get(ctx context.Context, key string, destination any) error
Set(ctx context.Context, key string, value any, ttl time.Duration) error
Delete(ctx context.Context, key string) error
Exists(ctx context.Context, key string) bool
Clear(ctx context.Context) error
TTL(ctx context.Context, key string) (time.Duration, error)
Touch(ctx context.Context, key string, ttl time.Duration) error
}
func NewFreecacheRepository ¶
func NewFreecacheRepository(size int, codec adapter_codec.Codec) ICacheRepository
func NewGoCacheRepository ¶
func NewGoCacheRepository( defaultExpiration time.Duration, cleanupInterval time.Duration, codec adapter_codec.Codec, ) ICacheRepository
func NewGoRedisRepository ¶
func NewGoRedisRepository(client *redis.Client, codec adapter_codec.Codec) ICacheRepository
Source Files
¶
Click to show internal directories.
Click to hide internal directories.