Skip to main content
Version: Next

SET CACHE SIZE

SET CACHE SIZE ( size {; minFreeSize} )

ParameterTypeDescription
sizeRealSize of database cache in bytes
minFreeSizeRealMinimum number of bytes to release when cache is full

Description

The SET CACHE SIZE command sets the database cache size dynamically and, optionally, sets the mininum byte size at which to start to free memory.This command only works in local mode (4D Server and 4D); it cannot be used in 4D remote mode.

In size, pass the new size for the database cache in bytes. This new size is applied dynamically when the command is executed.

In minFreeSize, pass the minimum size of memory to release from the database cache when the engine needs to make space in order to allocate an object to it (value in bytes). The purpose of this option is to reduce the number of times that data is released from the cache in order to obtain better performance.
By default, if this option is not used, 4D unloads at least 10% of the cache when space is needed. If your database works with a large cache, it could be advantageous to use a fixed size that does not depend on the cache size. You can adjust this setting according to the size of the blocks of data being handled in your database.

Example

You want to add 100 MB to the current database cache size. You can write:

 var $currentCache : Real
 $currentCache:=Get cache size
  // current cache size is, for example, 419430400
 SET CACHE SIZE($currentCache+100000000)
  // current cache size is now 519430400

See also

Get cache size

Properties

Command number1399
Thread safe