Documentation
¶
Index ¶
Constants ¶
const DefaultMaxAge = 86400
DefaultMaxAge is a constant that can be used by stores for giving a storage a default max age. Is set to 86400 seconds (one day).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilesystemStore ¶
type FilesystemStore struct {
BasePath string
}
FilesystemStore provides an implementation of the Store interface that writes the storages to the filesystem, relative to the BasePath
func NewFilesystemStore ¶
func NewFilesystemStore() *FilesystemStore
NewFilesystemStore creates a new FilesystemStore with the OS' temporary directory as the BasePath
func (*FilesystemStore) Get ¶
func (store *FilesystemStore) Get(key string) (*Storage, error)
Get implements the Get method of the Store interface.
func (*FilesystemStore) Save ¶
func (store *FilesystemStore) Save(storage *Storage) error
Save implements the Save method of the Store interface.
type Storage ¶
type Storage struct { Values map[interface{}]interface{} Options Options }
Storage stores the underlying in-memory key-value map, and its options.
func NewStorage ¶
NewStorage creates a new storage, not in store, with the given key and max age.
type Store ¶
type Store interface { // Get must create a Storage if it doesn't exists and return it. // Note that the Storage must never be nil, even if there is a error // creating or reading it. See the 'InStore' attribute in Storage.Options. Get(key string) (error, *Storage) // Save must save a Storage to the store. Must also set the // Storage.Options.IsNew boolean to false before saving it. Save(storage *Storage) error }
Store provides an interface for implementating new stores