HttpContent. implementation of CachingHttpContentFactory which evicts invalid entries from the cache.
Uses a validationTime parameter to check files when they are accessed and/or sweepDelay parameter for a periodic sweep
for invalid entries in the cache.
HttpContent validation checks are configured through the validationTime parameter in the constructor.
If an HttpContent is found to be invalid it will be removed from the cache.
A value of -1 means that the cached HttpContent will never be checked if it is still valid,
a value of 0 means it is checked on every request,
a positive value indicates the number of milliseconds of the minimum time between validation checks.
This also remember a missed entry for the time set by validationTimems. After this has
elapsed the entry will be invalid and will be evicted from the cache at the next access.
| Modifier and Type | Class and Description |
|---|---|
| protected class | |
| protected static class |
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final Scheduler | |
| private final long | |
| private final long |
| Access | Constructor and Description |
|---|---|
| public | ValidatingCachingHttpContentFactory(HttpContent.
the wrapped authority,HttpContent. to use.time between filesystem checks in ms to see if an validationPeriod, ByteBufferPool HttpContent is still valid (-1 never validate, 0 always validate).the bufferPool)org. to use.Construct a |
| public | ValidatingCachingHttpContentFactory(HttpContent.
the wrapped authority,HttpContent. to use.time between filesystem checks in ms to see if an validationPeriod, ByteBufferPool HttpContent is still valid (-1 never validate, 0 always validate).the bufferPool, Scheduler org. to use.scheduler to use for the sweeper, can be null to not use sweeper. scheduler, long time between runs of the sweeper in ms (if 0 never sweep for invalid entries). sweepPeriod, long amount of time in ms an entry can be unused before evicted by the sweeper (if 0 never evict unused entries). idleTimeout)Construct a |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | isCacheable(HttpContent
the HttpContent to test. httpContent)Overrides org. |
| protected CachingHttpContentFactory. | newCachedContent(String p, HttpContent httpContent)
Overrides org. |
| protected CachingHttpContentFactory. | |
| public void | |
| private void |
| _maxCacheIdleTime | back to summary |
|---|---|
| private final long _maxCacheIdleTime | |
| _scheduler | back to summary |
|---|---|
| private final Scheduler _scheduler | |
| _sweepDelay | back to summary |
|---|---|
| private final long _sweepDelay | |
| _validationTime | back to summary |
|---|---|
| private final long _validationTime | |
| ValidatingCachingHttpContentFactory | back to summary |
|---|---|
| public ValidatingCachingHttpContentFactory(HttpContent. Construct a
| |
| ValidatingCachingHttpContentFactory | back to summary |
|---|---|
| public ValidatingCachingHttpContentFactory(HttpContent. Construct a
| |
| isCacheable | back to summary |
|---|---|
| protected boolean isCacheable(HttpContent httpContent) Overrides org. Doc from org. Tests whether the given HttpContent is cacheable, and if there is enough room to fit it in the cache.
| |
| newCachedContent | back to summary |
|---|---|
| protected CachingHttpContentFactory. Overrides org.
| |
| newNotFoundContent | back to summary |
|---|---|
| protected CachingHttpContentFactory. Overrides org.
| |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| schedule | back to summary |
|---|---|
| private void schedule() | |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicLong | |
| private final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| _lastValidated | back to summary |
|---|---|
| private final AtomicLong _lastValidated | |
| _validationTime | back to summary |
|---|---|
| private final long _validationTime | |
| ValidatingCachedContent | back to summary |
|---|---|
| public ValidatingCachedContent(String key, HttpContent httpContent, long validationTime) | |
| isValid | back to summary |
|---|---|
| public boolean isValid() Overrides org. Implements org.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicLong | |
| private final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| _lastValidated | back to summary |
|---|---|
| private final AtomicLong _lastValidated | |
| _validationTime | back to summary |
|---|---|
| private final long _validationTime | |
| ValidatingNotFoundContent | back to summary |
|---|---|
| public ValidatingNotFoundContent(String key, long validationTime) | |
| isValid | back to summary |
|---|---|
| public boolean isValid() Overrides org. Implements org.
| |