Berkeley DB
version 5.3.28

com.sleepycat.db
Class CacheFile

java.lang.Object
  extended by com.sleepycat.db.CacheFile

public class CacheFile
extends Object

This class allows applications to modify settings for a Database using the Database.getCacheFile.


Method Summary
 long getMaximumSize()
          Return the maximum size for the file backing the database, or 0 if no maximum file size has been configured.
 boolean getNoFile()
          Return true if the opening of backing temporary files for in-memory databases has been disallowed.
 CacheFilePriority getPriority()
          Return the cache priority for pages from the specified file.
 boolean getUnlink()
          Return true if the file will be removed when the last reference to it is closed.
 void setMaximumSize(long bytes)
          Set the maximum size for the file backing the database.
 void setNoFile(boolean onoff)
          Disallow opening backing temporary files for in-memory databases, even if they expand to fill the entire cache.
 void setPriority(CacheFilePriority priority)
          Set the cache priority for pages from the specified file.
 void setUnlink(boolean onoff)
          Remove the file when the last reference to it is closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPriority

public CacheFilePriority getPriority()
                              throws DatabaseException
Return the cache priority for pages from the specified file.

This method may be called at any time during the life of the application.

Returns:
The cache priority for pages from the specified file.

Throws:
DatabaseException - if a failure occurs.

setPriority

public void setPriority(CacheFilePriority priority)
                 throws DatabaseException
Set the cache priority for pages from the specified file.

The priority of a page biases the replacement algorithm to be more or less likely to discard a page when space is needed in the buffer pool. The bias is temporary, and pages will eventually be discarded if they are not referenced again. Setting the priority is only advisory, and does not guarantee pages will be treated in a specific way.

This method may be called at any time during the life of the application.

Parameters:
priority - The cache priority for pages from the specified file.

Throws:
DatabaseException - if a failure occurs.

getMaximumSize

public long getMaximumSize()
                    throws DatabaseException
Return the maximum size for the file backing the database, or 0 if no maximum file size has been configured.

This method may be called at any time during the life of the application.

Returns:
The maximum size for the file backing the database, or 0 if no maximum file size has been configured.

Throws:
DatabaseException - if a failure occurs.

setMaximumSize

public void setMaximumSize(long bytes)
                    throws DatabaseException
Set the maximum size for the file backing the database.

Attempts to allocate new pages in the file after the limit has been reached will fail.

This method may be called at any time during the life of the application.

Parameters:
bytes - The maximum size for the file backing the database.

Throws:
DatabaseException - if a failure occurs.

getNoFile

public boolean getNoFile()
                  throws DatabaseException
Return true if the opening of backing temporary files for in-memory databases has been disallowed.

This method may be called at any time during the life of the application.

Returns:
True if the opening of backing temporary files for in-memory databases has been disallowed.

Throws:
DatabaseException - if a failure occurs.

setNoFile

public void setNoFile(boolean onoff)
               throws DatabaseException
Disallow opening backing temporary files for in-memory databases, even if they expand to fill the entire cache.

Attempts to create new file pages after the cache has been filled will fail.

This method may be called at any time during the life of the application.

Parameters:
onoff - If true, disallow opening backing temporary files for in-memory databases, even if they expand to fill the entire cache.

Throws:
DatabaseException - if a failure occurs.

getUnlink

public boolean getUnlink()
                  throws DatabaseException
Return true if the file will be removed when the last reference to it is closed.

This method may be called at any time during the life of the application.

Returns:
True if the file will be removed when the last reference to it is closed.

Throws:
DatabaseException - if a failure occurs.

setUnlink

public void setUnlink(boolean onoff)
               throws DatabaseException
Remove the file when the last reference to it is closed.

This method may be called at any time during the life of the application.

Parameters:
onoff - If true, remove the file when the last reference to it is closed.

Throws:
DatabaseException - if a failure occurs.

Berkeley DB
version 5.3.28

Copyright (c) 1996, 2013 Oracle and/or its affiliates. All rights reserved.