org.apache.commons.cache
Class ShareableFileStash

java.lang.Object
  extended by org.apache.commons.cache.BaseStash
      extended by org.apache.commons.cache.ShareableFileStash
All Implemented Interfaces:
Serializable, Stash

public class ShareableFileStash
extends BaseStash
implements Stash

tk.

Version:
$Id: ShareableFileStash.java 155435 2005-02-26 13:17:27Z dirkv $
Author:
Rodney Waldhoff
See Also:
Serialized Form

Field Summary
protected  int _maxFilenameLength
           
protected  int _numDirectories
           
protected  File _rootdir
           
 
Fields inherited from interface org.apache.commons.cache.Stash
NO, NO_FULL, NO_NOT_STORABLE, YES
 
Constructor Summary
ShareableFileStash(File root, int numdirs)
           
ShareableFileStash(File root, int numdirs, int maxfilenamelength)
           
ShareableFileStash(String root, int numdirs)
           
ShareableFileStash(String root, int numdirs, int maxfilenamelength)
           
 
Method Summary
 int canStore(Serializable key, Serializable val, Long expiresAt, Long cost, Serializable group, byte[] serialized)
           
 float capacity()
           
 void clear()
           
 void clear(Serializable key)
           
 boolean contains(Serializable key)
           
protected  File getFile(Serializable key, boolean mkdirs)
           
protected  File getMoveToLoc()
           
protected  byte[] getSerializedForm(Serializable val)
           
protected  Serializable readFromFile(File file)
           
 Serializable retrieve(Serializable key)
           
 void setCache(Cache c)
           
 boolean store(Serializable key, Serializable val, Long expiresAt, Long cost, Serializable group, byte[] serialized)
           
 void unsetCache()
           
 boolean wantsSerializedForm()
          Returns false.
 
Methods inherited from class org.apache.commons.cache.BaseStash
canStore, store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.cache.Stash
canStore, store
 

Field Detail

_numDirectories

protected int _numDirectories

_rootdir

protected File _rootdir

_maxFilenameLength

protected int _maxFilenameLength
Constructor Detail

ShareableFileStash

public ShareableFileStash(String root,
                          int numdirs)
Parameters:
root - the root directory to store objects in
numdirs - the number of directories to create under root (must be >0)

ShareableFileStash

public ShareableFileStash(File root,
                          int numdirs)
Parameters:
root - the root directory to store objects in
numdirs - the number of directories to create under root (must be >0)

ShareableFileStash

public ShareableFileStash(File root,
                          int numdirs,
                          int maxfilenamelength)
Parameters:
root - the root directory to store objects in
numdirs - the number of directories to create under root (must be >0)
maxfilenamelength - the maximum length filename to create

ShareableFileStash

public ShareableFileStash(String root,
                          int numdirs,
                          int maxfilenamelength)
Parameters:
root - the root directory to store objects in
numdirs - the number of directories to create under root (must be >0)
maxfilenamelength - the maximum length filename to create
Method Detail

getSerializedForm

protected byte[] getSerializedForm(Serializable val)

readFromFile

protected Serializable readFromFile(File file)

getFile

protected File getFile(Serializable key,
                       boolean mkdirs)

canStore

public int canStore(Serializable key,
                    Serializable val,
                    Long expiresAt,
                    Long cost,
                    Serializable group,
                    byte[] serialized)
Specified by:
canStore in interface Stash
Specified by:
canStore in class BaseStash

store

public boolean store(Serializable key,
                     Serializable val,
                     Long expiresAt,
                     Long cost,
                     Serializable group,
                     byte[] serialized)
Specified by:
store in interface Stash
Specified by:
store in class BaseStash

retrieve

public Serializable retrieve(Serializable key)
Specified by:
retrieve in interface Stash
Specified by:
retrieve in class BaseStash

contains

public boolean contains(Serializable key)
Specified by:
contains in interface Stash
Specified by:
contains in class BaseStash

capacity

public float capacity()
Specified by:
capacity in interface Stash
Specified by:
capacity in class BaseStash

clear

public void clear(Serializable key)
Specified by:
clear in interface Stash
Specified by:
clear in class BaseStash

clear

public void clear()
Specified by:
clear in interface Stash

wantsSerializedForm

public boolean wantsSerializedForm()
Description copied from class: BaseStash
Returns false.

Specified by:
wantsSerializedForm in interface Stash
Overrides:
wantsSerializedForm in class BaseStash
Returns:
false.

unsetCache

public void unsetCache()
Specified by:
unsetCache in interface Stash
Specified by:
unsetCache in class BaseStash

setCache

public void setCache(Cache c)
Specified by:
setCache in interface Stash
Specified by:
setCache in class BaseStash

getMoveToLoc

protected File getMoveToLoc()


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.