org.ehcache.core.spi.service
Interface LocalPersistenceService

All Superinterfaces:
MaintainableService, PersistableResourceService, Service
All Known Implementing Classes:
DefaultLocalPersistenceService

public interface LocalPersistenceService
extends PersistableResourceService

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 destroyAll()
          Destroys all persistence spaces Note that this method can be called without creating the persistence space beforehand in the same JVM.
 LocalPersistenceService.PersistenceSpaceIdentifier getOrCreatePersistenceSpace(java.lang.String name)
          Retrieves an existing or creates a new persistence space
 
Methods inherited from interface org.ehcache.spi.service.PersistableResourceService
additionalConfigurationsForPool, create, destroy, handlesResourceType
 
Methods inherited from interface org.ehcache.spi.service.MaintainableService
startForMaintenance
 
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

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

destroyAll

void destroyAll()
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.

Specified by:
destroyAll in interface PersistableResourceService