Example #1
0
  /** Enable the cache. */
  public void enable() {
    M_log.debug("enable()");

    m_disabled = false;

    if (m_resourcePattern != null) {
      m_eventTrackingService.addPriorityObserver(this);
    }
  } // enable
Example #2
0
  /**
   * Construct the Cache. Event scanning if pattern not null - will expire entries.
   *
   * @param sleep The number of seconds to sleep between expiration checks.
   * @param pattern The "startsWith()" string for all resources that may be in this cache - if null,
   *     don't watch events for expiration.
   */
  public MemCache(
      BasicMemoryService memoryService,
      EventTrackingService eventTrackingService,
      String pattern,
      Ehcache cache) {
    this(memoryService, eventTrackingService, cache);
    m_resourcePattern = pattern;

    // register to get events - first, before others
    if (pattern != null) {
      m_eventTrackingService.addPriorityObserver(this);
    }
  }