Challenge Overview
Background
Recently, All internal system of TopCoder are using TC Cache which is using JBoss Cache as caching service, but this is outdated and keeps on causing problems in production.
What TopCoder would like to do is to move ahead with a more mature cache service, such as for example like Redis.
Scope
For this challenge, we'd like to implement the related interfaces against Redis Service.
- Implement com.topcoder.web.common.cache.address.CacheAddress interface for redis, see other implemenation of com.topcoder.web.common.cache.address pacage for referfence.
- Implement com.topcoder.web.common.cache.CacheClient interface for redis interaction, a list of recommanded java client can be found at http://redis.io/clients#java, for this challenge, please use Jedis
- the configuration should go to the cache.properties file,
- Please write Unit Tests for your implementations, you can use https://github.com/kstyrc/embedded-redis for testing purpose.
- Please write integration tests for real redis server, like redis service in docker, like https://hub.docker.com/_/redis/
- For the above tests, please add ant targets for execution.
- The glue code for using Redis Implementation will be Topcoder - TC Cache Module Improvement, but please make sure your implementation can easily adapted with that.
Sample External Usage Code
boolean hasCacheConnection = true; CacheAddress address = AddressFactory.create(request, maxAge); Map<String, ResultSetContainer> map = null; DataRetrieverInt dr = null; CacheClient cc = null; try { //cc = CacheClientFactory.createCacheClient(); cc = CacheClientFactory.create(); map = (Map<String, ResultSetContainer>) (cc.get(address)); } catch (Exception e) { if (log.isDebugEnabled()) { log.error("UNABLE TO ESTABLISH A CONNECTION TO THE CACHE: ", e); } else { log.error("UNABLE TO ESTABLISH A CONNECTION TO THE CACHE: " + e.getMessage()); } hasCacheConnection = false; }
Final Submission Guidelines
- Changed Files
- Documentation and Verification Steps.