Sunday 4 December 2011

Auto-refreshing Caches - Part 2

In case you can't guess from the title of this post, this is the second in a series of posts related to my experiences developing and tuning an auto-refreshing cache.

Challenges for pre-loading

The particular caching software which we applied for this project has a typical key-oriented lookup for determining whether an item has already been populated into the cache.


The code for pre-loading of entries into the cache needs to use the same key value as a regular cache lookup will use.
- The default cache key generation system may not be appropriate.
- The key generation settings need to be kept in sync between the pre-loader and the regular fetcher.


Unit testing the service layer

By setting up a unit test for the pre-loading of each cache we have added some automated checking of the cache key generation.

The steps required are:
- Mocking of DAO for service layer to use in tests
- Calling service layer with known parameters
- Generating expected cache key with same known parameters
- Asserting that the expected cache key matches with the key of the cached entry.


Company Christmas Party

Recently the company that I currently work for acquired 80% ownership of an e-commerce company that I previously worked for.

I'll see a few more familiar faces at the Christmas party this week.

With a bit of luck I might even do some match-making - borrowing a developer to give the team a hand for my current project.