JBoss.org Community Documentation
In addition to
Cache
and
Node
interfaces, JBoss Cache exposes more powerful
CacheSPI
and
NodeSPI
interfaces, which offer more control over the internals
of JBoss Cache. These interfaces are not intended for general use, but are designed for people who wish to
extend and enhance JBoss Cache, or write custom
Interceptor
or
CacheLoader
instances.
The
CacheSPI
interface cannot be created, but is injected into
Interceptor
and
CacheLoader
implementations by the
setCache(CacheSPI cache)
methods on these interfaces.
CacheSPI
extends
Cache
so all the functionality of the basic API is made available.
Similarly, a
NodeSPI
interface cannot be created. Instead, one is obtained by performing operations on
CacheSPI
,
obtained as above. For example,
Cache.getRoot() : Node
is overridden as
CacheSPI.getRoot() : NodeSPI
.
It is important to note that directly casting a
Cache
or
Node
to it's SPI
counterpart is not recommended and is bad practice, since the inheritace of interfaces it is not a contract
that is guaranteed to be upheld moving forward. The exposed public APIs, on the other hand, is guaranteed to
be upheld.