Commits

Anonymous committed 9d191da

[CACHE-56] - a refreshPeriod is no longer required

  • Participants
  • Parent commits 5443129

Comments (0)

Files changed (1)

src/core/java/com/opensymphony/oscache/base/Cache.java

      * Retrieve an object from the cache specifying its key.
      *
      * @param key             Key of the object in the cache.
+     *
+     * @return The object from cache
+     *
+     * @throws NeedsRefreshException Thrown when the object either
+     * doesn't exist, or exists but is stale. When this exception occurs,
+     * the CacheEntry corresponding to the supplied key will be locked
+     * and other threads requesting this entry will potentially be blocked
+     * until the caller repopulates the cache. If the caller choses not
+     * to repopulate the cache, they <em>must</em> instead call
+     * {@link #cancelUpdate(String)}.
+     */
+    public Object getFromCache(String key) throws NeedsRefreshException {
+        return getFromCache(key, CacheEntry.INDEFINITE_EXPIRY, null);
+    }
+
+    /**
+     * Retrieve an object from the cache specifying its key.
+     *
+     * @param key             Key of the object in the cache.
      * @param refreshPeriod   How long before the object needs refresh. To
      * allow the object to stay in the cache indefinitely, supply a value
      * of {@link CacheEntry#INDEFINITE_EXPIRY}.