net.sf.ashkay.strategies
Class LastModifiedCachingStrategy
java.lang.Object
net.sf.ashkay.strategies.LastModifiedCachingStrategy
- All Implemented Interfaces:
- CachingStrategy
- public class LastModifiedCachingStrategy
- extends java.lang.Object
- implements CachingStrategy
LastModifiedCachingStrategy attempts to locate a timestamped resource and check the last time that resource was modified.
This is a tricky thing to do, and thusly, at the current time, LastModifiedCachingStrategy only works with Files and URLs.
Since we can't guarantee the entry value will remain around, LastModifiedCachingStrategy only works with the entry key as
well. So, LastModifiedCachingStrategy will work if you are looking up an object from the cache based on a file name or url
key. It will work with keys that are of type java.io.File, java.net.URL and java.lang.String. If the key is a string,
LastModifiedCachingStrategy will try to turn it first into a File and if that fails, a URL. Obviously, for URLs, your
java.net stuff needs to be working (ie. the network is connected).
Method Summary |
CacheEntry |
prepare(CacheEntry entry)
Prepares the cache entry for caching with this strategy.
NOTE: Be Careful: a caching strategy is allowed to return
a different CacheEntry, so make sure that you store the results of this
method and don't assume the symantics of pass by reference. |
boolean |
validate(CacheEntry entry)
Validates this cache entry for this caching strategy. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LastModifiedCachingStrategy
public LastModifiedCachingStrategy()
prepare
public CacheEntry prepare(CacheEntry entry)
- Prepares the cache entry for caching with this strategy.
NOTE: Be Careful: a caching strategy is allowed to return
a different CacheEntry, so make sure that you store the results of this
method and don't assume the symantics of pass by reference.
- Specified by:
prepare
in interface CachingStrategy
validate
public boolean validate(CacheEntry entry)
- Validates this cache entry for this caching strategy.
- Specified by:
validate
in interface CachingStrategy
Copyright © 2004 . All Rights Reserved.