public class AttachmentCache extends Object
Session.get(Class, java.io.Serializable)
.
Doesn't cache misses.
Because the persistent ID of the latest version of an attachment never changes, there's no need to synchronise this cache when an attachment is modified.
CachingAttachmentDao
Constructor and Description |
---|
AttachmentCache(com.atlassian.vcache.VCacheFactory cacheFactory) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(long contentId,
String fileName)
Returns true if the cache contains the composite key of content ID + file
name.
|
Long |
get(long contentId,
String fileName)
Returns the ID of the attachment with the given content ID, file name
and version, or null if no attachment is in the cache.
|
void |
put(Attachment attachment)
Caches the ID of the current version of an attachment (which should
never change) against its content ID + file name.
|
void |
remove(Attachment attachment)
Removes the given attachment from the cache.
|
void |
removeAll()
Removes all entries from the cache.
|
public AttachmentCache(com.atlassian.vcache.VCacheFactory cacheFactory)
public boolean contains(long contentId, String fileName)
public void put(Attachment attachment) throws IllegalArgumentException
IllegalArgumentException
- if the attachment's content reference is
null.public Long get(long contentId, String fileName)
public void remove(Attachment attachment) throws IllegalArgumentException
IllegalArgumentException
- if the attachment's content reference is
null.public void removeAll()
Copyright © 2003–2017 Atlassian. All rights reserved.