mirror of
https://github.com/gofiber/storage.git
synced 2025-10-05 16:48:25 +08:00
28 lines
824 B
Go
28 lines
824 B
Go
package storage
|
|
|
|
import "time"
|
|
|
|
// Storage interface that is implemented by storage providers for different
|
|
// middleware packages like cache, limiter, session and csrf
|
|
type Storage interface {
|
|
// Get retrieves the value for the given key.
|
|
// If no value is not found it returns ErrNotExit error
|
|
Get(key string) ([]byte, error)
|
|
|
|
// Set stores the given value for the given key along with a
|
|
// time-to-live expiration value, 0 means live for ever
|
|
// The key must not be "" and the empty values are ignored.
|
|
Set(key string, val []byte, ttl time.Duration) error
|
|
|
|
// Delete deletes the stored value for the given key.
|
|
// Deleting a non-existing key-value pair does NOT lead to an error.
|
|
// The key must not be "".
|
|
Delete(key string) error
|
|
|
|
// Reset the storage
|
|
Reset() error
|
|
|
|
// Close the storage
|
|
Close() error
|
|
}
|