private void configureCacheManager(CacheStore cacheStore) { context.cacheManager = new CacheManager(cacheStore); if (!context.test) { CacheController controller = new CacheController(context.cacheManager); context.httpServer.get("/management/cache", controller::list); context.httpServer.get("/management/cache/:name/:key", controller::get); context.httpServer.delete("/management/cache/:name/:key", controller::delete); } }
public void local() { logger.info("create local session provider"); LocalSessionStore sessionStore = new LocalSessionStore(); context .scheduler() .addTrigger( new FixedRateTrigger( "cleanup-local-session", new CleanupLocalSessionStoreJob(sessionStore), Duration.ofMinutes(30))); context.httpServer.siteManager.sessionManager.sessionStore(sessionStore); }
public void redis(String host) { if (context.isTest()) { logger.info("use local session during test"); local(); } else { logger.info("create redis session provider, host={}", host); RedisImpl redis = new RedisImpl(); redis.host(host); redis.pool.name("redis-session"); context .scheduler() .addTrigger( new FixedRateTrigger( "refresh-redis-session-pool", new RefreshPoolJob(redis.pool), Duration.ofMinutes(5))); context.shutdownHook.add(redis::close); context.httpServer.siteManager.sessionManager.sessionStore(new RedisSessionStore(redis)); } }