org.thymeleaf.cache.ICache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.everit.osgi.bundles.org.thymeleaf.thymeleaf Show documentation
Show all versions of org.everit.osgi.bundles.org.thymeleaf.thymeleaf Show documentation
XML/XHTML/HTML5 template engine for Java
The newest version!
/*
* =============================================================================
*
* Copyright (c) 2011-2013, The THYMELEAF team (http://www.thymeleaf.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
package org.thymeleaf.cache;
/**
*
* Common interface for all the cache objects used by the template engine.
*
*
* This is the interface that must be implemented by all cache objects managed
* by {@link ICacheManager} implementations.
*
*
* @author Daniel Fernández
*
* @since 2.0.0
*
* @param the type of the cache keys
* @param the type of the cache values
*/
public interface ICache {
/**
*
* Insert a new value into the cache.
*
*
* @param key the key of the new entry
* @param value the value to be cached
*/
public void put(final K key, final V value);
/**
*
* Retrieve a value from the cache.
*
*
* @param key the key of the value to be retrieved
* @return the retrieved value, or null if no value exists for the specified key.
*/
public V get(final K key);
/**
*
* Retrieve a value from the cache, using the specified validity checker
* to ensure the entry is still valid. If the cache already has a default validity
* checker, this method should override this setting and use the one specified
* instead.
*
*
* @param key the key of the value to be retrieved
* @param validityChecker the validity checker to be used to ensure the entry is still valid.
* @return the retrieved value, or null if no value exists for the specified key.
*/
public V get(final K key, final ICacheEntryValidityChecker super K, ? super V> validityChecker);
/**
*
* Clear the entire cache.
*
*/
public void clear();
/**
*
* Clears a specific entry in the cache.
*
*
* @param key the key of the entry to be cleared.
*/
public void clearKey(final K key);
}