diff options
Diffstat (limited to 'cmd/server/app.go')
| -rw-r--r-- | cmd/server/app.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/server/app.go b/cmd/server/app.go index 9a00628..c694753 100644 --- a/cmd/server/app.go +++ b/cmd/server/app.go @@ -7,14 +7,17 @@ import ( "github.com/gomodule/redigo/redis" "gopkg.in/yaml.v3" + "riedstra.dev/mitch/go-website/mapcache" "riedstra.dev/mitch/go-website/page" ) var FeedPrefixDefault = ".feeds" type App struct { + mapCache bool redisPool *redis.Pool RedisKey string + cache *mapcache.Cache ReIndexPath string StaticDirectory string @@ -86,6 +89,16 @@ func loadConf(fn string) (*App, error) { return app, nil } +func (a *App) ClearCache() error { + if a.redisPool != nil { + return a.ClearRedis() + } + + a.cache.Clear() + + return nil +} + // ClearRedis is a little helper function that allows us to easily clear // the redis cache at runtime. func (a *App) ClearRedis() error { |
