org.wso2.carbon.registry.app
Class CachedResources

java.lang.Object
  extended by org.wso2.carbon.registry.app.CachedResources

public class CachedResources
extends Object

Implementation to cache resources along with an Entity Tag.


Constructor Summary
CachedResources()
          Default constructor which initializes cache.
 
Method Summary
 boolean cacheResource(String path, Resource resource, String eTag, long size)
          Method to cache a given resource along with an Entity Tag.
 Resource getCachedResource(String path)
          Method to fetch a cached resource.
 String getETag(String path)
          Returns the Entity Tag corresponding to the given path.
 int getSizeOfCache()
          Method to obtain the size of the cache.
 boolean isResourceCached(String path)
          Method to determine whether the resource at the given path is cached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedResources

public CachedResources()
Default constructor which initializes cache.

Method Detail

isResourceCached

public boolean isResourceCached(String path)
Method to determine whether the resource at the given path is cached.

Parameters:
path - the resource path.
Returns:
whether cached or not.

cacheResource

public boolean cacheResource(String path,
                             Resource resource,
                             String eTag,
                             long size)
Method to cache a given resource along with an Entity Tag.

Parameters:
path - the resource path.
resource - the resource to cache.
eTag - the entity tag.
size - the maximum cache size.
Returns:
whether the operation succeeded or not.

getCachedResource

public Resource getCachedResource(String path)
Method to fetch a cached resource.

Parameters:
path - the resource path.
Returns:
the cached resource if it is cached or null if not.

getETag

public String getETag(String path)
Returns the Entity Tag corresponding to the given path.

Parameters:
path - the resource path.
Returns:
the Entity Tag.

getSizeOfCache

public int getSizeOfCache()
Method to obtain the size of the cache.

Returns:
the size of the cache.


Copyright © 2011 WSO2 Inc. All Rights Reserved.