Documentation ¶
Index ¶
- Constants
- type InMemoryStore
- func (s *InMemoryStore) Delete(key string) error
- func (s *InMemoryStore) Exists(key string) bool
- func (s *InMemoryStore) Flush() error
- func (s *InMemoryStore) Get(key string) ([]byte, error)
- func (s *InMemoryStore) Replace(key string, newVal []byte, expire time.Duration) error
- func (s *InMemoryStore) Set(key string, value []byte, expire time.Duration) error
- type Store
Constants ¶
View Source
const ( // DefaultExpire 0 second expire duration DefaultExpire = time.Duration(0) // ForeverExpire forever expire duration ForeverExpire = time.Duration(-1) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryStore ¶
InMemoryStore to save cache into memory can be read and write
func (*InMemoryStore) Delete ¶
func (s *InMemoryStore) Delete(key string) error
Delete func implement presistence.Store interface
func (*InMemoryStore) Exists ¶
func (s *InMemoryStore) Exists(key string) bool
Exists func implement presistence.Store interface
func (*InMemoryStore) Flush ¶
func (s *InMemoryStore) Flush() error
Flush func implement presistence.Store interface
func (*InMemoryStore) Get ¶
func (s *InMemoryStore) Get(key string) ([]byte, error)
Get func implement presistence.Store interface
type Store ¶
type Store interface { // Set func to Set item with params Set(key string, value []byte, expire time.Duration) error // Get func to Get item with params Get(key string) ([]byte, error) // Replace func to Replace item with params Replace(key string, newVal []byte, expire time.Duration) error // Exists func to Exists item with params Exists(key string) bool // Delete func to Delete item with params Delete(key string) error // Flush func to flush all data Flush() error }
Store interface to presist data into database or file etc.
Click to show internal directories.
Click to hide internal directories.