public class

NoCacheCache

extends AbstractCache<V, T>
implements Cache<V, T>
java.lang.Object
   ↳ org.apache.archiva.redback.components.cache.AbstractCache<V, T>
     ↳ org.apache.archiva.redback.components.cache.impl.NoCacheCache<V, T>

Class Overview

Simple no-op provider of a Cache.

Nothing is stored, nothing is tracked, no statistics even.

Summary

Public Constructors
NoCacheCache()
Public Methods
void clear()
Clear the cache of all entries.
T get(V key)
Get the value of the specified key, if it exists in the cache.
CacheStatistics getStatistics()
Obtain a set of Statistics about the performance of the cache.
boolean hasKey(V key)
Tests to see if the provided key exists within the cache.
T put(V key, T value)
Put the specified value into the cache under the provided key.
void register(V key, T value)
Register the specified value into the cache under the provided key.
T remove(V key)
Remove the specified key and value from the cache.
[Expand]
Inherited Methods
From class org.apache.archiva.redback.components.cache.AbstractCache
From class java.lang.Object
From interface org.apache.archiva.redback.components.cache.Cache

Public Constructors

public NoCacheCache ()

Public Methods

public void clear ()

Clear the cache of all entries.

public T get (V key)

Get the value of the specified key, if it exists in the cache.

Parameters
key the key to fetch the contents of.
Returns
  • the value of the key, or null if not found.

public CacheStatistics getStatistics ()

Obtain a set of Statistics about the performance of the cache.

Returns
  • the cache statistics.

public boolean hasKey (V key)

Tests to see if the provided key exists within the cache.

NOTE: Due to synchronization issues, if this method returns true, a subsequent request to the get(Object) method on the same key might return null as the period of time between the 2 request might have been long enough for the underlying Cache implementation to remove the key.

Parameters
key the key to test.
Returns
  • true if the key exists.

public T put (V key, T value)

Put the specified value into the cache under the provided key.

Parameters
key the key to put the value into
value the object to place into the cache.
Returns
  • the previous value for the key, or null if the key contained no value.

public void register (V key, T value)

Register the specified value into the cache under the provided key.

This register(Object, Object) method is just an optimized version of the put(Object, Object) method, but does not return the previous value contained with the specified key.

Parameters
key the key to put the value into
value the object to place into the cache.

public T remove (V key)

Remove the specified key and value from the cache.

Parameters
key the key to the value to remove.
Returns
  • the value of the key that was removed.