Documentation ¶
Index ¶
- type Cacher
- type Manager
- type MongoManager
- func (m *MongoManager) Create(data SessionCache, collectionName string) error
- func (m *MongoManager) Delete(k string, collectionName string) error
- func (m *MongoManager) Get(k string, collectionName string) (*SessionCache, error)
- func (m *MongoManager) Update(u SessionCache, collectionName string) error
- type SessionCache
- type Storer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { Storer }
Manager provides a generic interface to key value cache objects in order to build a DataStore
type MongoManager ¶
type MongoManager struct {
DB *mgo.Database
}
MongoManager cares for the managing of the Mongo Session instance for a mongo cache.
func (*MongoManager) Create ¶
func (m *MongoManager) Create(data SessionCache, collectionName string) error
Create provides a way to Create a cache object that has been stored in Mongo. Assumes the struct passed in has bson parsing parameters provided in the incoming struct. Namely `_id` must be mapped.
func (*MongoManager) Delete ¶
func (m *MongoManager) Delete(k string, collectionName string) error
Delete provides a way to Delete a cache object that has been stored in Mongo
func (*MongoManager) Get ¶
func (m *MongoManager) Get(k string, collectionName string) (*SessionCache, error)
Get provides a way to Get a cache object that has been stored in Mongo
func (*MongoManager) Update ¶
func (m *MongoManager) Update(u SessionCache, collectionName string) error
Update provides a way to Update an old cache object that has been stored in Mongo
type SessionCache ¶
type SessionCache struct { ID string `bson:"_id" json:"id" xml:"id"` Signature string `bson:"signature" json:"signature" xml:"signature"` }
SessionCache allows storing a map between a session ID and a session signature
func (SessionCache) GetKey ¶
func (s SessionCache) GetKey() string
GetKey returns the key of the cached session map
func (SessionCache) GetValue ¶
func (s SessionCache) GetValue() string
GetValue returns session data as a string
type Storer ¶
type Storer interface { Create(cacheObject SessionCache, collectionName string) error Get(key string, collectionName string) (*SessionCache, error) Update(cacheObject SessionCache, collectionName string) error Delete(key string, collectionName string) error }
Storer provides a way to create cache based objects in mongo