Package org.springmodules.cache.provider.gigaspaces

Examples of org.springmodules.cache.provider.gigaspaces.GigaSpacesCachingModel


    assertEquals(expectedCachedObject, entry);
  }

  private Object getCacheElement(int keyAndModelIndex) throws Exception {
    KeyAndModel keyAndModel = getKeyAndModel(keyAndModelIndex);
    GigaSpacesCachingModel model = (GigaSpacesCachingModel) keyAndModel.model;
    IMap cache = (IMap) CacheFinder.find(model.getCacheName());
    return cache.get(keyAndModel.key);
  }
View Full Code Here


   *
   * @see CacheModelParser#parseCachingModel(Element)
   */
  public CachingModel parseCachingModel(Element element) {
    String cacheName = element.getAttribute("cacheName");
    GigaSpacesCachingModel model = new GigaSpacesCachingModel(cacheName);
    String timeToLiveAttr = element.getAttribute("timeToLive");
    String waitForResponseAttr = element.getAttribute("waitForResponse");
    if (StringUtils.hasText(timeToLiveAttr)) {
      try {
        long timeToLive = Long.parseLong(timeToLiveAttr);
        model.setTimeToLive(timeToLive);
      }
      catch (NumberFormatException exception) {
        // ignore exception
      }
    }
    if (StringUtils.hasText(waitForResponseAttr)) {
      try {
        long waitForResponse = Long.parseLong(waitForResponseAttr);
        model.setWaitForResponse(waitForResponse);
      }
      catch (NumberFormatException exception) {
        // ignore exception
      }
    }
View Full Code Here

    Element element = new DomElementStub("caching");
    element.setAttribute("cacheName", cacheName);
    element.setAttribute("timeToLive", "2");
    element.setAttribute("waitForResponse", "2");
    CachingModel actual = parser.parseCachingModel(element);
    GigaSpacesCachingModel expected = new GigaSpacesCachingModel(cacheName);
    expected.setTimeToLive(2l);
    expected.setWaitForResponse(2l);

    assertEquals(expected, actual);
  }
View Full Code Here

TOP

Related Classes of org.springmodules.cache.provider.gigaspaces.GigaSpacesCachingModel

Copyright © 2018 www.massapicom. 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.