gosora/cache.go
Azareal f7942b42ac Continued the work on Cosora.
Trying to add support for Travis CI.

Added the NullUserStore for tests.
Moved more text out of the templates.
Removed an unnecessary dependency for Cosora.
Fixed a few more bugs in the MSSQL Adapter.
Disabled upserts for now, as it isn't working on MySQL.
Refactored the scheduled group logic to reduce the number of potential bugs and to stop using upserts.
Fixed many bugs in the Markdown Plugin.
Added the ability to escape Markdown.
Fixed a number of tests, commented unneccesary ones, and added new ones to probe for new problems.
Added the wink smiley.
Cleaned up some of the JavaScript.
Refactored the permissions logic to use transactions and avoid duplicating logic.
Added the ChangeRank method to the Group struct.
Added the ChangeGroup method to the User struct.
Added the currently unused LogWarning function.
Added the transaction versions of the builder methods. Better ones coming up soon!
The IsBanned flag is always set to false on mod and admin groups now.
Refactored the group creation logic to use transactions.
Fixed a bug in the group creator where new groups aren't visible to Exists().
The installer now drops tables for MySQL Databases, if they already exist to make it easier for us to run automated tests.
Added more ARIA Attributes.
2017-10-21 01:27:47 +01:00

38 lines
1.2 KiB
Go

package main
import "errors"
// Go away, linter. We need to differentiate constants from variables somehow ;)
// nolint
const CACHE_STATIC int = 0
const CACHE_DYNAMIC int = 1
const CACHE_SQL int = 2
// nolint
// ErrCacheDesync is thrown whenever a piece of data, for instance, a user is out of sync with the database. Currently unused.
var ErrCacheDesync = errors.New("The cache is out of sync with the database.") // TODO: A cross-server synchronisation mechanism
// ErrStoreCapacityOverflow is thrown whenever a datastore reaches it's maximum hard capacity. I'm not sure if this error is actually used. It might be, we should check
var ErrStoreCapacityOverflow = errors.New("This datastore has reached it's maximum capacity.") // nolint
// nolint
type DataStore interface {
Load(id int) error
Get(id int) (interface{}, error)
BypassGet(id int) (interface{}, error)
//GetGlobalCount()
}
// nolint
type DataCache interface {
CacheGet(id int) (interface{}, error)
CacheGetUnsafe(id int) (interface{}, error)
CacheSet(item interface{}) error
CacheAdd(item interface{}) error
CacheAddUnsafe(item interface{}) error
CacheRemove(id int) error
CacheRemoveUnsafe(id int) error
GetLength() int
GetCapacity() int
}