temenostech/IRIS — pull request #156 by andrewmcguinness (2014-11-25 14:12:37+00:00)
Title: Cache implementation

A simple in-memory unshared cache keyed by URI for GET requests, configured by specifying a cache parameter (which is the maximum cache age in seconds for that resource) on a resource state in the RIM file.

The major functionality is in **interaction-core/src/main/java/com/temenos/interaction/core/rim/HTTPHypermediaRIM.java** , with the cache implementation itself in **interaction-core/src/main/java/com/temenos/interaction/core/cache/HashMapCache.java** and a test case in **interaction-examples/interaction-hateoas-simple/src/test/java/com/interaction/example/hateoas/simple/CacheITCase.java**

The change involved adding a parameter to the constructor for InteractionContext, to provide the request URI which is used as the cache key. This is a relatively non-disruptive change, as the InteractionContext is created only within HTTPHypermediaRIM, but there are a large number of tests which use InteractionContext objects, so there are a lot of changes to test setup code for functions unrelated to caching as InteractionContext objects are created or mocked.