From 6e1c76efe681943742e5eac3b43cda0de6b26104 Mon Sep 17 00:00:00 2001 From: John Guo Date: Sun, 23 Jan 2022 15:14:06 +0800 Subject: [PATCH] add GetAdapter for package gcache; add GetStorage for package gsession --- os/gcache/gcache_cache.go | 5 +++++ os/gsession/gsession_manager.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/os/gcache/gcache_cache.go b/os/gcache/gcache_cache.go index f716d63ac..9a039457c 100644 --- a/os/gcache/gcache_cache.go +++ b/os/gcache/gcache_cache.go @@ -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...) diff --git a/os/gsession/gsession_manager.go b/os/gsession/gsession_manager.go index 192cb09a7..36802708b 100644 --- a/os/gsession/gsession_manager.go +++ b/os/gsession/gsession_manager.go @@ -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