Skip to content

Simple Java "lambda" techniques make a method cacheable by ehCache without introducing dependency injection. Target audience is legacy applications looking to add modern distributed caching but stuck in Java 1.4 syntax for some reason.

License

Notifications You must be signed in to change notification settings

hartsock/lambda-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lambda Cache is distributed under the Apache 2.0 license

It is a proof of concept that an API for ehCache could be injected into an existing Java 1.4 code base without the introduction of AOP, AspectJ or other meta-programming technologies. Instead we use simple anonymous-inner-class-as-a-lambda techniques to make a method cacheable with the introduction of 4 lines of code.

(The goal was 2 lines of code but that became difficult to accomplish cleanly.)

An example of the simplest use of cache is shown in the test class SimpleCacheUser and features 4 lines of code for caching wrapping a simple method.

see: src/test/java/com/pssd/cache/SimpleCacheUser.java

Once you can cache using ehCache you now have the possibility of reconfiguring to use Terracotta or other distributed cache technologies.

TODO: allow configuration from XML files in classpath to override configurations embedded in classes.

About

Simple Java "lambda" techniques make a method cacheable by ehCache without introducing dependency injection. Target audience is legacy applications looking to add modern distributed caching but stuck in Java 1.4 syntax for some reason.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages