Code example for Cache

Methods: invalidateAll

0
   */ 
  public InMemorySessionTokenCache reset(int duration, TimeUnit unit) {
 
    // Build the cache 
    if (sessionTokenCache != null) {
      sessionTokenCache.invalidateAll();
    } 
 
    // If there is no activity against a key then we want 
    // it to be expired from the cache, but each fresh write 
    // will reset the expiry timer 
    sessionTokenCache = CacheBuilder
      .newBuilder()
      .expireAfterWrite(duration, unit)
      .maximumSize(1000)
      .build();
 
    return INSTANCE;
  }