You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
690 B
45 lines
690 B
11 years ago
|
package mightypork.util.constraints;
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
|
* Constraint cache
|
||
|
*
|
||
|
* @author MightyPork
|
||
|
* @param <C> constraint type
|
||
|
*/
|
||
|
public interface ConstraintCache<C> extends Pollable {
|
||
|
|
||
|
/**
|
||
|
* Called after the cache has changed value (and digest).
|
||
|
*/
|
||
|
void onChange();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @return the cached value
|
||
|
*/
|
||
|
C getCacheSource();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Enable caching & digest caching
|
||
|
*
|
||
|
* @param yes enable caching
|
||
|
*/
|
||
|
void enableCaching(boolean yes);
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @return true if caching is on
|
||
|
*/
|
||
|
boolean isCachingEnabled();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Update cached value and cached digest (if digest caching is enabled).<br>
|
||
|
* source constraint is polled beforehand.
|
||
|
*/
|
||
|
@Override
|
||
|
void poll();
|
||
|
}
|