Documentation
¶
Index ¶
- Variables
- type Cache
- type CacheItem
- type FilesystemCache
- func (f *FilesystemCache) GetTTL() time.Duration
- func (f *FilesystemCache) GetTranslation(ctx context.Context, projectID int, languageCode, format string) (*CacheItem, error)
- func (f *FilesystemCache) PingContext(ctx context.Context) error
- func (f *FilesystemCache) PurgeProject(ctx context.Context, projectID int) error
- func (f *FilesystemCache) PurgeTranslation(ctx context.Context, projectID int, languageCode string) error
- func (f *FilesystemCache) SetTranslation(ctx context.Context, projectID int, languageCode, format string, data []byte) (string, error)
- type RedisCache
- func (r *RedisCache) GetTTL() time.Duration
- func (r *RedisCache) GetTranslation(ctx context.Context, projectID int, languageCode, format string) (*CacheItem, error)
- func (r *RedisCache) PingContext(ctx context.Context) error
- func (r *RedisCache) PurgeProject(ctx context.Context, projectID int) error
- func (r *RedisCache) PurgeTranslation(ctx context.Context, projectID int, languageCode string) error
- func (r *RedisCache) SetTranslation(ctx context.Context, projectID int, languageCode, format string, data []byte) (string, error)
- type RedisCacheItem
- type RedisLogger
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCacheMiss = errors.New("Cache miss")
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { GetTranslation(ctx context.Context, projectID int, languageCode, format string) (item *CacheItem, err error) SetTranslation(ctx context.Context, projectID int, languageCode, format string, data []byte) (checksum string, err error) PurgeTranslation(ctx context.Context, projectID int, languageCode string) (err error) PurgeProject(ctx context.Context, projectID int) (err error) GetTTL() time.Duration PingContext(ctx context.Context) error }
type FilesystemCache ¶
type FilesystemCache struct {
// contains filtered or unexported fields
}
func NewFilesystemCache ¶
func NewFilesystemCache(cacheDir string, ttl time.Duration) (*FilesystemCache, error)
func (*FilesystemCache) GetTTL ¶ added in v0.1.1
func (f *FilesystemCache) GetTTL() time.Duration
func (*FilesystemCache) GetTranslation ¶
func (*FilesystemCache) PingContext ¶ added in v0.4.0
func (f *FilesystemCache) PingContext(ctx context.Context) error
func (*FilesystemCache) PurgeProject ¶
func (f *FilesystemCache) PurgeProject(ctx context.Context, projectID int) error
func (*FilesystemCache) PurgeTranslation ¶
func (*FilesystemCache) SetTranslation ¶
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache(c *redis.Client, ttl time.Duration) *RedisCache
func (*RedisCache) GetTTL ¶ added in v0.1.1
func (r *RedisCache) GetTTL() time.Duration
func (*RedisCache) GetTranslation ¶
func (*RedisCache) PingContext ¶ added in v0.4.0
func (r *RedisCache) PingContext(ctx context.Context) error
func (*RedisCache) PurgeProject ¶
func (r *RedisCache) PurgeProject(ctx context.Context, projectID int) error
func (*RedisCache) PurgeTranslation ¶
func (*RedisCache) SetTranslation ¶
type RedisCacheItem ¶
type RedisLogger ¶ added in v0.1.1
Click to show internal directories.
Click to hide internal directories.