The dcachemake program

dcachemake - create a DCACHE from the standard input.




dcachemake creates a cache file CACHE.

The default data size is 10 MB, the default number of records is one per 1024 bytes of data size.

TMPFILE is the name of the file during the creation of the cache. TMPFILE will be renamed to CACHE atomically as soon as the input has been read. TMPFILE and CACHE have to be located on the same file system.

If TMPFILE is not given then the cache will be created as CACHE. This might interfere with other programs accessing CACHE during this time.


-a, --add
Add to an existing cache. Do not create a new one. INPUT will be appended to the existing cache CACHE. TMPFILE is not used.
-d, --print-deleted
Print the keys of deleted records. The keys will be formatted as +KEYLEN:KEY
-e, --elements=NUMBER
Set the maximum number of records. The hash tables in the cache will be sized to allow operation without too many hash collisions for this number of records, allowing for 50% more records to be used with slightly worse performance. If the hash table is full then the oldest record will be deleted. Note: this value cannot be changed after the cache creation. Default: one slot per 1024 bytes of data.
-h, --hole
Create a cache containing holes. The default is to reserve the space during the creation of the file. This option is unsafe as cache corruption may occur if the operating system at the wrong time detects that no free space is left on the device.
-m, --maxsize=NUMBER
Set the maximum cache data size in bytes. The data space in the cache will be limited to that many bytes. If a new record is added and doesn't fit into the cache then the oldest records will be deleted until enough space is free. Use this option for smaller cache sizes, as it is limited to sizes less than 4 GB. Note: this value cannot be changed after the cache creation. Note, too: if both --maxsize and --max-mb are given then --max-mb is preferred. Default: 10 MB
-M, --max-mb=NUMBER
Set the maximum cache data size in megabytes. See above. Use this option for caches larger than 4GB.
-N, --no-sync
Do not fsync the cache to disk. The default is to call fsync, which waits until the data has been written to disk. This is costly but safe. Using this option allows the operating system to schedule the writing to a later time, thus making it impossible to detect any error due to, for example, a bad hard disk. The use of this option is not recommended unless speed is more important than correctness. Note that fsync costs about 5 to 10 percent of a second.
-T, --transaction
Add all new records in one transaction. This costs a lot of memory and disk space, and makes only a difference to the normal mode of operation in that it is sure that, if the operation is stopped in between, the new records are either all visible or not visible at all.
An description of the input format.
Where to find related information.
Usage examples.
Show version: dcachemake (dcache) 0.6.1-beta2.
Show a list of options or the long help on one. The use with an argument shows the long help text of that option, without an argument it will list all options.
Show longer help texts for all or one option.


echo | dcachemake -M 48 dcache

  creates an empty dcache with 48 MB size.

dcachedump <old-cache | dcachemake -M 1024 new-cache

  copies the content of one cache to a new one with 1GB of space.


dcachemake expects the standard input to be a set of records plus an additional newline. A record is encoded like this:


followed by a newline character. This format is similar to the format used by cdbmake and cdbdump (, dyndbmake and dyndbdump (

 KEYLEN is the length of the KEY, in bytes.
 DATALEN is the length of the DATA, in bytes.
 [@TAIA] is an `at' (@) character followed by tai64 label.
 KEY stands for the key. The key needs to fit into the memory.
 DATA is the data.

The tai64 label is encoded as a stream of 16 hey digits (see for more information) and is optional. The tools in the package interpret it as an expiry value, meaning that one cannot retrieve the record after that point in time, but this behaviour can be turned off.

An example for valid input:


Two records, one with two bytes data, no expiry date, the second with expiry date, but without data. The records are followed by an empty line.


Copyright (C) 2003,2004,2005 Uwe Ohse.

The software comes with NO WARRANTY, to the extent permitted by law.

This package is published under the terms of the GNU General Public License version 2. Later versions of the GPL may or may not apply, see


Uwe Ohse, <>.


Please report bugs to <>


dcachedump(1) dumps a dcache. dcache_intro(7) is the introduction to dcache.

The dcache homepage is at