add GetAdapter for package gcache; add GetStorage for package gsession

This commit is contained in:
John Guo
2022-01-23 15:14:06 +08:00
parent e517bf7b0e
commit 6e1c76efe6
2 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,11 @@ func (c *Cache) SetAdapter(adapter Adapter) {
c.localAdapter = adapter
}
// GetAdapter returns the adapter that is set in current Cache.
func (c *Cache) GetAdapter() Adapter {
return c.localAdapter
}
// Removes deletes `keys` in the cache.
func (c *Cache) Removes(ctx context.Context, keys []interface{}) error {
_, err := c.Remove(ctx, keys...)

View File

@ -60,6 +60,11 @@ func (m *Manager) SetStorage(storage Storage) {
m.storage = storage
}
// GetStorage returns the session storage of current manager.
func (m *Manager) GetStorage() Storage {
return m.storage
}
// SetTTL the TTL for the session manager.
func (m *Manager) SetTTL(ttl time.Duration) {
m.ttl = ttl