Java Code Examples for org.ehcache.core.spi.store.tiering.CachingTier

Following code examples demonstrate how to use org.ehcache.core.spi.store.tiering.CachingTierfrom ehcache. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.ehcache.core.spi.store.tiering.CachingTierand various code implementation of this class.

  public void testSupportsMultipleAuthoritativeTierProviders() throws Exception {

    ServiceLocator.DependencySet dependencySet = dependencySet();

    OnHeapStore.Provider cachingTierProvider = new OnHeapStore.Provider();
    OffHeapStore.Provider authoritativeTierProvider = new OffHeapStore.Provider();
    OffHeapDiskStore.Provider diskStoreProvider = new OffHeapDiskStore.Provider();

    dependencySet.with(cachingTierProvider);
    dependencySet.with(authoritativeTierProvider);
    dependencySet.with(diskStoreProvider);
    dependencySet.with(mock(DiskResourceService.class));

    ServiceLocator serviceLocator = dependencySet.build();
    serviceLocator.startAllServices();

    assertThat(serviceLocator.getServicesOfType(CachingTier.Provider.class),
      IsCollectionContaining.<CachingTier.Provider>hasItem(IsSame.<CachingTier.Provider>sameInstance(cachingTierProvider)));
    assertThat(serviceLocator.getServicesOfType(AuthoritativeTier.Provider.class),
      IsCollectionContaining.<AuthoritativeTier.Provider>hasItem(IsSame.<AuthoritativeTier.Provider>sameInstance(authoritativeTierProvider)));
    assertThat(serviceLocator.getServicesOfType(OffHeapDiskStore.Provider.class),
      IsCollectionContaining.<OffHeapDiskStore.Provider>hasItem(IsSame.<OffHeapDiskStore.Provider>sameInstance(diskStoreProvider)));
  } 


Advertisement
Javadoc
Caching tier is the abstraction for tiers sitting atop the AuthoritativeTier.

As soon as

there is more than one tier in a Store, one will be the AuthoritativeTier while others will be regrouped under the CachingTier @param the key type @param the value type

Read More
Advertisement