Documentation
¶
Overview ¶
Package pgx provides a PostgreSQL implementation of cache.Cache.
Values are stored gob-encoded. When the cache is parameterised with V=any, decoding goes through *interface{} and gob requires the concrete value type to be pre-registered:
gob.Register(MyStruct{})
Without registration, Get returns "gob: type not registered for interface". Caches parameterised with a concrete V (e.g. Cache[string, MyStruct]) round-trip directly and need no registration.
Index ¶
- Variables
- type Cache
- func (c *Cache[K, V]) Add(key K, value V, ttl time.Duration) (bool, error)
- func (c *Cache[K, V]) Close() error
- func (c *Cache[K, V]) Get(key K) (V, error)
- func (c *Cache[K, V]) Keys(prefix K) []K
- func (c *Cache[K, V]) Pop(key K) (V, error)
- func (c *Cache[K, V]) Remove(keys ...K) error
- func (c *Cache[K, V]) Set(key K, value V, ttl time.Duration) error
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = cache.ErrNotFound DefaultOperationTimeout = 10 * time.Second DefaultCleanupInterval = 5 * time.Minute DefaultTableName = "cache_entries" )
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.