gosora/cache.go
Azareal 6fdf615cf5 Topic and user edits should now update the caches. Ditto for topic deletions.
The tests and benchmarks now run again.
gloinit() is always called prior to the tests and benchmarks now.
The tests and benchmarks no longer use hard-coded session strings for admin route tests.
Added some new route tests.
We now pull the database version into a variable.
Fixed an issue with guest perms not applying properly.
Tweaked the router to make it a little more efficient.
Moved more topic / user parsing logic into CascadeGet
Profiles now use the user cache.
Added the Set method to the caches. Set is used when you don't know if an item exists in a cache or not.
Added the Load method to the caches. Load is used to forcefully reload an item in a cache from the database.
2017-02-15 10:49:30 +00:00

26 lines
595 B
Go

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")
var users UserStore
var topics TopicStore
type DataStore interface {
Load(id int) error
Get(id int) (interface{}, error)
GetUnsafe(id int) (interface{}, error)
CascadeGet(id int) (interface{}, error)
Set(item interface{}) error
Add(item interface{}) error
AddUnsafe(item interface{}) error
Remove(id int) error
RemoveUnsafe(id int) error
GetLength() int
GetCapacity() int
}