Documentation
¶
Index ¶
Constants ¶
View Source
const ( DriverMemory = "memory" DriverRedis = "redis" NoExpiration = -1 * time.Second )
Variables ¶
View Source
var ( // ErrInvalidCacheDriver is returned when an invalid cache driver is provided ErrInvalidCacheDriver = errors.New("invalid cache driver") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Get returns the value for the given key
// returns the value if the key was found
// returns an error if the key was not found
Get(ctx context.Context, key string) (interface{}, error)
// Set sets the value for the given key
// returns nil if the key was set successfully
// returns an error if the key was not set successfully
Set(ctx context.Context, key string, value string, ttl time.Duration) error
// Delete deletes the value for the given key
// returns nil if the key was deleted successfully
// returns an error if the key was not deleted successfully
Delete(ctx context.Context, key string) error
}
Cache implements a generic interface for cache clients
Click to show internal directories.
Click to hide internal directories.