Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Simple caching framework
Scala Java Shell
Branch: master

Merge pull request #6 from guardian/tm_update_scala_version

major version change:  upgrade to java 1.7 and scala 2.11.7.
latest commit 7f391dc194
@tpemckiernan tpemckiernan authored
Failed to load latest commit information.
dev Fix SBT launcher
project truly a major version change
.gitignore Move to git.
sbt Fix SBT launcher


What is it?

Simplecache is intended to be a cache interface library with a simple abstraction. At present, simplecache supports EhCache, Memcached and java.util.concurrent.ConcurrentMap backends.

How do I use it?

In sbt, add the Guardian repository to your build.sbt:

resolvers += "Guardian Github Releases" at ""

Find the latest version by inspecting the available simplecache-core artifacts in the repository at:

Then include at least the simplecache-core artifact in your build.sbt:

libraryDependencies += "" % "simplecache-core" % "2.1"

Depending on your application requirements you may want to also include some backend projects. At present, the available artifacts include:

  • simplecache-core: This is the base artifact, including the interfaces and a java.util.concurrent.ConcurrentMap implementation using soft references.

  • simplecache-ehcache: This includes an adaptor and dependencies for using an EhCache backed simplecache.

  • simplecache-memcached: This includes an adaptor, statistics reporting and dependencies for using a Memcached backed simplecache.

  • simplecache-hibernate: Hibernate Regions and AccessStrategy implementations facilitating the use of simplecaches for Hibernate caches.

  • simplecache-memcached-spring: Spring FactoryBeans for dependency injecting simplecache-memcached code into a Spring application context.

If, like us, you have a Spring/Hibernate application with an Ehcache second level Hibernate cache backing to a shared Memcached, you might find it easier to include all of the above using the simplecache-all convenience package.

SimpleCache in the simplecache-core project is the interface of interest. Put your hands on something that implements that. Some ways of doing that are:

  • New up a SoftReferenceSimpleCache.
  • New up an EhcacheSimpleCacheAdaptor from and Ehcache object.
  • Create a SpyMemcachedClientAdaptor using objects from the spy-memcached library and an MD5KeyTranslator to new up a MemcachedSimpleCacheAdaptor.
  • Use the TwoLevelSimpleCacheAggregator to build a cache chain from existing SimpleCache objects.

How do I build it?

Simplecache is a scala project built using simple-build-tool 0.11. Build using:

./sbt package

To use in intellij, setup and use the idea plugin by creating the following definition in ~/.sbt/plugins/build.sbt:

resolvers += "sbt-idea-repo" at ""

libraryDependencies <+= (sbtVersion) {
  case "0.10.0" => "com.github.mpeltonen" % "sbt-idea_2.8.1" % "0.10.0" from ""
  case "0.10.1" => "com.github.mpeltonen" % "sbt-idea_2.8.1" % "0.10.1-SNAPSHOT" from ""
  case "0.11.0" => "com.github.mpeltonen" % "sbt-idea_2.9.1" % "0.11.0" from ""
  case sbtv => error("Unsupported SBT version: " + sbtv)

Then run the following in interactive sbt:


The sbt console is very useful. FYou can do e.g. the following:

> console
Welcome to Scala version (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_16).
Type in expressions to have them evaluated.
Type :help for more information.

scala> ...

Further documentation notes and useful items can be found in dev.

How do I release it?

  • Clone the repository to your home directory.

  • Update the version number in project\SimpleCacheBuild.scala

  • Invoke sbt and run the +publish goal. This will create the necessary structure in the cloned project.

  • Run from the clone to refresh the HTML index pages.

  • Commit and push

  • Update the version numbers in simplecache to the new development version number.

  • Commit and push simplecache.

Something went wrong with that request. Please try again.