Package it.tidalwave.image
Class DefaultImageModelCache
- java.lang.Object
-
- it.tidalwave.image.ImageModelCache
-
- it.tidalwave.image.DefaultImageModelCache
-
public class DefaultImageModelCache extends ImageModelCache
- Author:
- Fabrizio Giudici
-
-
Constructor Summary
Constructors Constructor Description DefaultImageModelCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.io.Serializable id)
Returns true if there's a local copy with the given id.void
remove(java.io.Serializable ic, boolean remote)
Removes an ImageModel from the cache.ImageModel
retrieve(java.io.Serializable id, boolean remote)
Finds an ImageModel in the cache.void
store(ImageModel imageModel)
Adds an ImageModel to the cache.void
update(ImageModel imageModel)
Updates an ImageModel in the cache.-
Methods inherited from class it.tidalwave.image.ImageModelCache
getInstance, setDefault
-
-
-
-
Method Detail
-
store
public void store(ImageModel imageModel)
Description copied from class:ImageModelCache
Adds an ImageModel to the cache. The image is always added only in the local cache. Remote caches will pull the images they lack on demand.- Specified by:
store
in classImageModelCache
- Parameters:
imageModel
- the ImageModel to add
-
update
public void update(ImageModel imageModel)
Description copied from class:ImageModelCache
Updates an ImageModel in the cache. This means that all remote copies of this image will be invalidated. TODO: should investigate more complex cases. Maybe the remote workers still want to work with a remote snapshot. Include versioning instead of invalidating?- Specified by:
update
in classImageModelCache
- Parameters:
imageModel
- the ImageModel to update
-
remove
public void remove(java.io.Serializable ic, boolean remote)
Description copied from class:ImageModelCache
Removes an ImageModel from the cache. According to the value of theremote
parameter, the operation is performed only locally or also to remote caches.- Specified by:
remove
in classImageModelCache
- Parameters:
ic
- the id of the ImageModel to remove
-
retrieve
public ImageModel retrieve(java.io.Serializable id, boolean remote)
Description copied from class:ImageModelCache
Finds an ImageModel in the cache. According to the value of theremote
parameter, the search is performed only locally or also to remote caches.- Specified by:
retrieve
in classImageModelCache
- Parameters:
id
- the id of the ImageModel to remove
-
contains
public boolean contains(java.io.Serializable id)
Description copied from class:ImageModelCache
Returns true if there's a local copy with the given id.- Specified by:
contains
in classImageModelCache
- Parameters:
id
- the id of the ImageModel to remove- Returns:
- true if there's a local copy
-
-