2017-02-11 14:51:16 +00:00
|
|
|
package main
|
|
|
|
import "errors"
|
|
|
|
|
|
|
|
const CACHE_STATIC int = 0
|
|
|
|
const CACHE_DYNAMIC int = 1
|
|
|
|
const CACHE_SQL int = 2
|
|
|
|
|
|
|
|
var ErrStoreCapacityOverflow = errors.New("This datastore has already reached it's max capacity")
|
|
|
|
|
|
|
|
type DataStore interface {
|
2017-02-15 10:49:30 +00:00
|
|
|
Load(id int) error
|
2017-02-11 14:51:16 +00:00
|
|
|
Get(id int) (interface{}, error)
|
|
|
|
GetUnsafe(id int) (interface{}, error)
|
|
|
|
CascadeGet(id int) (interface{}, error)
|
2017-06-06 14:41:06 +00:00
|
|
|
BypassGet(id int) (interface{}, error)
|
2017-02-15 10:49:30 +00:00
|
|
|
Set(item interface{}) error
|
2017-02-11 14:51:16 +00:00
|
|
|
Add(item interface{}) error
|
|
|
|
AddUnsafe(item interface{}) error
|
|
|
|
Remove(id int) error
|
|
|
|
RemoveUnsafe(id int) error
|
|
|
|
GetLength() int
|
|
|
|
GetCapacity() int
|
|
|
|
}
|