Creates an SRP Hash Table.

Syntax

Handle = SRP_HashTable_Create(CaseSensitiveFlag, ApproximateCount)

Returns

A handle to a new SRP List.

Parameters

ParameterDescription
CaseSensitiveFlagDetermines whether or not the hash table keys are case sensitive. (OPTIONAL, 0 by default)
ApproximateCountThe estimated number of elements the hash table will contain (OPTIONAL)

Remarks

The SRP_HashTable_Create method creates a new SRP Hash Table. An SRP Hash Table is an in-memory hash table that stores key-value pairs. Just like OpenInsight tables store records identified by unique keys, SRP Hash Tables store variables identified by unique keys.

OpenInsight tables always use case-sensitive keys. However, you can decide whether or not SRP Hash Tables use case-sensitive or case-insensitive keys using the CaseSensitiveFlag parameter. Setting it to 1 makes the hash table case-sensitive whereas 0 makes it case-insensitive. Omitting this parameter is the same as setting it to 0.

The ApproximateCount parameter is useful for optimizing large hash tables. In most cases, you can omit this parameter. However, if you expect to have 10,000 or more entries, then setting this is recommended. You don't have to provide an accurate count and it doesn't hurt to pass a value larger than what you expect. Setting this parameter pre-allocates memory and optimizes the hashing algorithm accordingly.

IMPORTANT: You should always release the handle to an SRP Hash Table when you no longer need it by calling SRP_HashTable_Release.

Examples

// Create a case-insensitive hash table
Handle = SRP_HashTable_Create()

// Create a case-sensitive hash table
Handle = SRP_HashTable_Create(1)

// Create a case-sensitive hash table that will contain roughly 250,000 elements
Handle = SRP_HashTable_Create(1, 250000)
  • No labels