Examples of Cache


Examples of org.omnifaces.component.output.Cache

  }

  @Override
  public void apply(FaceletContext ctx, UIComponent parent) throws IOException {

    Cache cacheComponent;
    if (parent instanceof Cache) {
      cacheComponent = (Cache) parent;
    } else {
      throw new IllegalStateException("CacheValue components needs to have a Cache component as direct parent.");
    }

Examples of org.openbankdata.core.client.Cache

  @TestSubject
  private SveaDirektAccountService mAccountService;

  @Before
  public void setUp() {
    mockedCache = new Cache();
    mockedBankClient = EasyMock.createMock(SveaDirektBankClient.class);
    mockedTransactionService = EasyMock.createMock(SveaDirektTransactionService.class);
    mAccountService = new SveaDirektAccountService(mockedBankClient, mockedTransactionService);
  }

Examples of org.openxri.resolve.Cache

    */ /**
    *
    */
    public void testCache()
    {
        Cache oCache = new Cache(1000);
        assertTrue("Initial cache not empty", oCache.getNumNodes() == 0);

        XRD oDesc = new XRD();
        Service atAuthService = new Service();
        atAuthService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none");
        atAuthService.addType(Tags.SERVICE_AUTH_RES);
        atAuthService.addURI("http://gcs.epok.net/xri/resolve?ns=at");
        oDesc.addService(atAuthService);

        XRD oDummy = new XRD();
        Service dummyService = new Service();
        dummyService.addMediaType(Tags.CONTENT_TYPE_XRDS + ";trust=none");
        dummyService.addType(Tags.SERVICE_AUTH_RES);
        dummyService.addURI("http://www.example.com/xri/resolve?id=1");
        oDummy.addService(dummyService);

        GCSAuthority oAuth = new GCSAuthority("@");
        oCache.stuff(oAuth, oDesc);
        assertTrue("Initial cache incorrect", oCache.getNumNodes() == 1);

        oCache.stuff(
            (XRIAuthority) AuthorityPath.buildAuthorityPath("@!a!b!foo"), oDummy);
        assertTrue("Cache size incorrect", oCache.getNumNodes() == 4);

        oCache.stuff(
            (XRIAuthority) AuthorityPath.buildAuthorityPath("@!a!c!moo"), oDummy);
        assertTrue("Cache size incorrect", oCache.getNumNodes() == 6);

        oCache.stuff(
            (XRIAuthority) AuthorityPath.buildAuthorityPath("@!a!c!woo"), oDummy);
        assertTrue("Cache size incorrect", oCache.getNumNodes() == 7);

        Cache.CachedValue oVal =
            oCache.find(
                (XRIAuthority) AuthorityPath.buildAuthorityPath("@!a!c!woo"),
                false);
        assertTrue("Cached value not found", oVal != null);

        oVal =
            oCache.find(
                (XRIAuthority) AuthorityPath.buildAuthorityPath("@!a!b!woo"),
                false);
        assertTrue("Cached value should not have been found", oVal == null);
        oCache.dump();

    } // testCache()

Examples of org.richfaces.cache.Cache

            assert (resourcePath != null) && (resourcePath.length() != 0);

            ResourceRequestData data = resourceCodec.decodeResource(context, resourcePath);
            assert (data != null);

            Cache cache = ServiceTracker.getService(context, Cache.class);
            Resource resource = lookupInCache(cache, data.getResourceKey());

            if (resource == null) {
                resource = resourceFactory.createResource(context, data);
            }

            if (resource == null) {
                sendResourceNotFound(context);
                return;
            }

            if (resource instanceof CacheableResource) {
                CacheableResource cacheableResource = (CacheableResource) resource;

                if (cacheableResource.isCacheable(context)) {

                    // TODO - we could move this part of code to ConcurrentMap so that
                    // only single thread does resource put
                    CachedResourceImpl cachedResource = new CachedResourceImpl();

                    cachedResource.initialize(resource);

                    // someone may provided this resource for us
                    // while we were reading it, check once again
                    resource = lookupInCache(cache, data.getResourceKey());

                    if (resource == null) {
                        // don't cache it on Development stage
                        if (!ProjectStage.Development.equals(context.getApplication().getProjectStage())) {
                            Date cacheExpirationDate = cachedResource.getExpired(context);
                            if (LOGGER.isDebugEnabled()) {
                                LOGGER.debug(new MessageFormat(
                                        "Storing {0} resource in cache until {1,date,dd MMM yyyy HH:mm:ss zzz}", Locale.US)
                                        .format(new Object[] { data.getResourceKey(), cacheExpirationDate }));
                            }
                            cache.put(data.getResourceKey(), cachedResource, cacheExpirationDate);
                        }
                        resource = cachedResource;
                    }
                }
            }

Examples of org.rzo.yajsw.cache.Cache

    getWrapperLogger().info("init ");
    if (!_config.isLocalFile())
      if (_cache == null)
      {
        _cache = new Cache();
        _cache.load(_config);
      }

    String dbg = _config.getString("wrapper.debug");
    _debug = dbg == null ? false : dbg.equals("true");

Examples of org.sgx.yuigwt.yui.cache.Cache

  public void ready(final YuiContext Y) {
    final String cacheKey1 = "cachetestkey1", cacheKey2 = "cachetestkey2"
    parent.append("<p>The online cache tester: </p>");
    final Node p = parent.appendChild(
      "<input type=\"text\" value=\"value to store\"></input>");
    final Cache cache1 = Y.newCache(CacheConfig.create().max(5).expires(3600000));
    Y.newButton(ButtonConfig.create().label("Save").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        cache1.add(cacheKey1, p.get("value"));
      }
    }));
    Y.newButton(ButtonConfig.create().label("Load").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        p.set("value", cache1.retrieve(cacheKey1).responseString());
      }
    }));
   
    parent.append("<p>and the offline cache tester (html5): </p>");
    final Node p2 = parent.appendChild(
      "<input type=\"text\" value=\"value to store\"></input>");
    CacheOfflineConfig occ = (CacheOfflineConfig)CacheOfflineConfig.create();
    final Cache cache2 = Y.newCacheOffline(occ.sandbox("foobar4455z").max(5).expires(3600000));
    Y.newButton(ButtonConfig.create().label("Save").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        cache2.add(cacheKey2, p2.get("value"));
      }
    }));
    Y.newButton(ButtonConfig.create().label("Load").render(parent).on("click", new EventCallback() {     
      @Override
      public void call(EventFacade e) {
        p2.set("value", cache2.retrieve(cacheKey2).responseString());
      }
    }));
  }
});
}

Examples of org.shiftone.cache.Cache

    }

    public static void main(String[] args) throws Exception
    {

        Cache        cache;
        CacheFactory cacheFactory;
        Class        factoryClass;
        String       factoryClassName = FifoCacheFactory.class.getName();
        int          size             = 100;
        int          ttl              = 2000;

Examples of org.springframework.cache.Cache

            }
        }
    }

    public Cache getCache(String name) {
        Cache cache = caches.get(name);
        if (cache == null) {
            final IMap<Object, Object> map = hazelcastInstance.getMap(name);
            cache = new HazelcastCache(map);
            final Cache currentCache = caches.putIfAbsent(name, cache);
            if (currentCache != null) {
                cache = currentCache;
            }
        }
        return cache;

Examples of org.syncany.config.Cache

public class CacheTest {
  @Test
  public void testCacheSizeOkay() throws Exception {
    File testCacheFolder = TestFileUtil.createTempDirectoryInSystemTemp();
   
    Cache cache = new Cache(testCacheFolder);
    cache.setKeepBytes(50*1024);
   
    TestFileUtil.createRandomFilesInDirectory(testCacheFolder, 10*1024, 4);

    assertEquals(4, testCacheFolder.listFiles().length);
    cache.clear();   
    assertEquals(4, testCacheFolder.listFiles().length);
   
    TestFileUtil.deleteDirectory(testCacheFolder);
  }

Examples of org.teiid.cache.Cache

    Table t = RealMetadataFactory.exampleBQT().getGroupID("bqt1.smalla");
    cc.accessedDataObject(t);
    plan.setContext(cc);
    results.setResults(tb, plan);
    results.setCommand(new Query());
    Cache cache = new DefaultCache("dummy"); //$NON-NLS-1$
    long ts = results.getAccessInfo().getCreationTime();
    // simulate the jboss-cache remote transport, where the batches are remotely looked up
    // in cache
    for (int row=1; row<=tb.getRowCount();row+=4) {
      cache.put(results.getId()+","+row, tb.getBatch(row), null); //$NON-NLS-1$
    }
   
    results.prepare(cache, bm);
   
    CachedResults cachedResults = UnitTestUtil.helpSerialize(results);
   
    FakeMetadataFactory.buildWorkContext(RealMetadataFactory.exampleBQT());
   
    cachedResults.restore(cache, bm);
   
    // since restored, simulate a async cache flush
    cache.clear();
   
    TupleBuffer cachedTb = cachedResults.getResults();
   
    assertTrue(cachedTb.isFinal());
    assertEquals(tb.getRowCount(), cachedTb.getRowCount());
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.