[[simple_cache]]
==== Simple Cache

Traditional local caches use the same architecture as clustered caches, i.e. they use the interceptor stack.
That way a lot of the implementation can be reused. However, if the advanced features
are not needed and performance is more important, the interceptor stack can be stripped
away and simple cache can be used.

So, which features are stripped away? From the configuration perspective, simple cache does not support:

* transactions and invocation batching
* persistence (cache stores and loaders)
* custom interceptors (there's no interceptor stack!)
* indexing
* compatibility (embedded/server mode)
* store as binary (which is hardly useful for local caches)

From the API perspective these features throw an exception:

* adding custom interceptors
* Distributed Executors Framework

So, what's left?

* basic map-like API
* cache listeners (local ones)
* expiration
* eviction
* security
* JMX access
* statistics (though for max performance it is recommended to switch this off using statistics-available=false)

===== Declarative configuration

[source,xml]
----
   <local-cache name="mySimpleCache" simple-cache="true">
        <!-- expiration, eviction, security... -->
   </local-cache>
----

===== Programmatic configuration

[source,java]
----
CacheManager cm = getCacheManager();
ConfigurationBuilder builder = new ConfigurationBuilder().simpleCache(true);
cm.defineConfiguration("mySimpleCache", builder.build());
Cache cache = cm.getCache("mySimpleCache");
----

Simple cache checks against features it does not support, if you configure it to use e.g. transactions,
configuration validation will throw an exception.
