Sha256: 7fb246a659182b80947ce8dd9f165b4375c022b3642f5bc6be269c780eb23601
Contents?: true
Size: 1.32 KB
Versions: 6
Compression:
Stored size: 1.32 KB
Contents
module InfoparkComponentCache # @author Tomasz Przedmojski <tomasz.przedmojski@infopark.de> # # @abstract # This is abstract base class for any Cache Guards. # Any class inheriting ConsistencyGuard should implement #consistent? # and #guard! # # Cache Guard is a class that promises some consistency, for example # that no changes to the database accured between calls to #guard! # and #consistent? # # This consistency is crucial for the function of cache, because # inconsistent cache is (automatically) invalidated. class ConsistencyGuard attr_reader :component, :options def initialize(component, options = {}) @component = component @options = options end # @return [CacheStorage] instance of CacheStorage def cache CacheStorage.instance end # @abstract # This method returns true if the consistenty guarded by this class # is fulfilled and false otherwise. def consistent? raise TypeError, "Abstract method consistent? called" end # @abstract # This method is called whenever cache is updated for the component. # Any values checked by #consistent? can be persisted here. Use #{cache} # for persistence but mind the possible inconsistencies. def guard! raise TypeError, "Abstract method guard! called" end end end
Version data entries
6 entries across 6 versions & 1 rubygems