Next Previous Up Contents
Next: Default Policy
Up: Storage Policies
Previous: Storage Policies

### 4.1 Available Policies

The storage policies currently supplied as static members of the `StoragePolicy` class are as follows:

`PREFER_MEMORY`
  Stores table data in memory. Currently implemented using an `ArrayList` of `Object[]` arrays.
`PREFER_DISK`
  Generally attempts to store data in a temporary disk file, using row-oriented storage (elements of each row are mostly contiguous on disk).
`ADAPTIVE`
  Stores table data in memory for relatively small tables, and in a temporary disk file for larger ones. Storage is row-oriented.
`SIDEWAYS`
  Generally attempts to store data in temporary disk files using column-oriented storage (elements of each column are contiguous on disk). This may be more efficient for certain access patterns for tables which are very large and, in particular, very wide. It's generally more expensive on system resources than PREFER_DISK however, (it writes and maps one file per column) so it is only the best choice in rather specialised circumstances.
`DISCARD`
  Metadata is retained, but the rows are simply thrown away. The table returned from the row store has a row count of zero.

For the disk-based policies above (PREFER_DISK and SIDEWAYS), if storage on disk is impossible (e.g. the security manager prevents access to local disk) then they will fall back to memory-based storage. They may also decide to use memory-based storage for rather small tables. Any temporary disk files are written to the default temporary directory (`java.io.tmpdir`), and will be deleted when the RowStore is garbage collected, or on normal termination of the JVM. These policies are currently implemented using mapped file access.

You are quite at liberty to implement and use your own `StoragePolicy` objects, possibly on top of existing ones. For instance you could implement one which stored only the first ten rows of any array.

Next Previous Up Contents
Next: Default Policy
Up: Storage Policies
Previous: Storage Policies

STIL - Starlink Tables Infrastructure Library
Starlink User Note252
STIL web page: http://www.starlink.ac.uk/stil/
Author email: m.b.taylor@bristol.ac.uk