org.ehcache.spi.service
Interface LocalPersistenceService

All Superinterfaces:
Service
All Known Implementing Classes:
DefaultLocalPersistenceService

public interface LocalPersistenceService
extends Service

Service to provide persistence context to caches requiring it. Will be used by caches with a disk store, whether or not the data should survive a program restart.


Nested Class Summary
static interface LocalPersistenceService.PersistenceSpaceIdentifier
          An identifier for an existing persistence space.
 
Method Summary
 FileBasedPersistenceContext createPersistenceContextWithin(LocalPersistenceService.PersistenceSpaceIdentifier space, java.lang.String name)
          Creates a new persistence context within the given space.
 void destroyAllPersistenceSpaces()
          Destroys all persistence spaces Note that this method can be called without creating the persistence space beforehand in the same JVM.
 void destroyPersistenceSpace(java.lang.String name)
          Destroys the persistence space with the given name.
 LocalPersistenceService.PersistenceSpaceIdentifier getOrCreatePersistenceSpace(java.lang.String name)
          Retrieves an existing or creates a new persistence space
 
Methods inherited from interface org.ehcache.spi.service.Service
start, stop
 

Method Detail

getOrCreatePersistenceSpace

LocalPersistenceService.PersistenceSpaceIdentifier getOrCreatePersistenceSpace(java.lang.String name)
                                                                               throws CachePersistenceException
Retrieves an existing or creates a new persistence space

Parameters:
name - the name to be used for the persistence space
Returns:
a LocalPersistenceService.PersistenceSpaceIdentifier
Throws:
CachePersistenceException - if the persistence space cannot be created

destroyPersistenceSpace

void destroyPersistenceSpace(java.lang.String name)
                             throws CachePersistenceException
Destroys the persistence space with the given name. Note that this method can be called without creating the persistence space beforehand in the same JVM. It will nonetheless try to delete any persistent data that could have been associated with the name.

Parameters:
name - the name of the persistence context
Throws:
CachePersistenceException - if the persistence space cannot be destroyed

createPersistenceContextWithin

FileBasedPersistenceContext createPersistenceContextWithin(LocalPersistenceService.PersistenceSpaceIdentifier space,
                                                           java.lang.String name)
                                                           throws CachePersistenceException
Creates a new persistence context within the given space.

Parameters:
space - space to create within
name - name of the context to create
Returns:
a FileBasedPersistenceContext
Throws:
CachePersistenceException

destroyAllPersistenceSpaces

void destroyAllPersistenceSpaces()
Destroys all persistence spaces Note that this method can be called without creating the persistence space beforehand in the same JVM. It will nonetheless try to delete any persistent data associated with the root directory provided in the service.