Tabnine Logo
ExpirableCache.getObject
Code IndexAdd Tabnine to your IDE (free)

How to use
getObject
method
in
com.ebay.cloud.cms.utils.ExpirableCache

Best Java code snippets using com.ebay.cloud.cms.utils.ExpirableCache.getObject (Showing top 7 results out of 315)

origin: eBay/YiDB

/**
 * className is either metaclass name or pluralName
 * 
 * @param className
 * @return
 */
public MetaClass getMetaClassFromCache(String className) {
  MetaClass m = nameCache.getObject(className);
  if (m == null) {
    m = pluralNameCache.getObject(className);
  }
  return m;
}

origin: eBay/YiDB

public Integer getCountFromCache(String dbCollectionName){
  return countCache.getObject(dbCollectionName);
}

origin: eBay/YiDB

@Override
public Repository getRepository(String repositoryName) {
  Repository repo = null;
  BasicDBObject query = new BasicDBObject();
  query.put(Repository.REPOSITORY_FIELD_NAME, repositoryName);
  query.put(Repository.STATE_FIELD, Repository.StateEnum.normal.toString());
  boolean suggestRefresh = false;
  DBObject object = repoCollection.findOne(query);
  if (object != null) {
    repo = cache.getObject(repositoryName);
    if (repo == null) {
      suggestRefresh = true;
    }
  } else if (cache.getObject(repositoryName) != null) {
    suggestRefresh = true;
  }
  // find something different between the cache and the read db.
  if (suggestRefresh) {
    refreshRepositoryCache();
    repo = cache.getObject(repositoryName);
  }
  if (repo == null) {
    throw new RepositoryNotExistsException(repositoryName);
  }
  return repo;
}
origin: eBay/YiDB

@Test
public void expirationTest() throws InterruptedException {
  ExpirableCache<String> cache = new ExpirableCache<String>(100, 1);
  cache.putObject(c[0], c[0]);
  assertTrue(cache.getObject(c[0]) == c[0]);
  Thread.sleep(2000);
  assertNull(cache.getObject(c[0]));
}
 
origin: eBay/YiDB

@Test
public void deleteTest() {
  ExpirableCache<String> cache = new ExpirableCache<String>(100, 60);
  cache.putObject(c[0], c[0]);
  assertTrue(cache.getObject(c[0]) == c[0]);
  cache.deleteObject(c[0]);
  assertNull(cache.getObject(c[0]));
}
 
origin: eBay/YiDB

@Test
public void cacheTest() {
  ExpirableCache<String> cache = new ExpirableCache<String>(100, 60);
  
  for (String i : c) {
    cache.putObject(i, i);
  }
  
  for (String i : c) {
    String o = cache.getObject(i);
    assertTrue(o == c[Integer.valueOf(o)]);
  }
}
 
origin: eBay/YiDB

@Test
public void sizeTest() {
  ExpirableCache<String> cache = new ExpirableCache<String>(1, 60);
  cache.putObject(c[0], c[0]);
  cache.putObject(c[1], c[1]);
  assertNull(cache.getObject(c[0]));
  assertTrue(cache.getObject(c[1]) == c[1]);
}
 
com.ebay.cloud.cms.utilsExpirableCachegetObject

Popular methods of ExpirableCache

  • <init>
  • deleteObject
  • putObject
  • checkNotNull
  • cleanup
  • values

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • getSystemService (Context)
  • getResourceAsStream (ClassLoader)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Kernel (java.awt.image)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now