Provided by: golf_601.4.41-1_amd64 bug

NAME

       new-hash -  (hash)

PURPOSE

       Create hash.

SYNTAX

           new-hash <hash> \
               [ process-scope ] \
               [ hash-size <hash size> ]

DESCRIPTION

       new-hash  creates new <hash>. A hash is a collection of key/value pairs, called "elements". A value of an
       element is obtained based on its key value.

       SCOPE

       Note that a hash is accessible to the current request only, unless "process-scope"  clause  is  used,  in
       which  case  all  requests served by a process can use it (see do-once for a typical way to create a hash
       with a process scope).

       If "process-scope" is used, then <hash> will keep its data across all requests in a  given  process.  See
       write-hash for an example of a process-scoped hash.

       SIZING A HASH

       A  hash  can be of any size, as long as there is enough memory for it. The "hash-size" refers to the size
       of a hash table used to provide high-performance access to its elements based on a key.

       <hash size> is the number of "buckets" used by the hash (it is 10 by default). All hash elements with the
       same hash code are stored in a linked list within the same bucket. Greater <hash  size>  generally  means
       less elements per bucket and better performance. However, memory usage grows with a bigger hash table, so
       <hash size> should be balanced based on the program needs.

       Golf uses high-performing FNV1_a hash algorithm. Each element in a bucket list is lightweight, containing
       pointers to a key, value and next element in the linked list.

       <hash size> must be at least 256; if less, it will be set to 256.

EXAMPLES

       Create a new hash with 5000 buckets:

           new-hash h hash-size 5000

       See read-hash for more examples.

SEE ALSO

        Hash

       get-hash new-hash purge-hash read-hash resize-hash write-hash See all documentation

$DATE                                               $VERSION                                           GOLF(2gg)