<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Initialize Method</title><link>https://sourceforge.net/p/perfcache/wiki/Initialize%2520Method/</link><description>Recent changes to Initialize Method</description><atom:link href="https://sourceforge.net/p/perfcache/wiki/Initialize%20Method/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 14 Dec 2011 20:12:51 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/perfcache/wiki/Initialize%20Method/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Initialize Method modified by Glenn Hofford</title><link>https://sourceforge.net/p/perfcache/wiki/Initialize%2520Method/</link><description>&lt;pre&gt;--- v2 
+++ v3 
@@ -71,13 +71,14 @@
 
     pCache = Cache::CacheFactory();
 
-    int iResult = pCache-&gt;Initialize (25,    // lenMaxStringKey
-                                      300,   // numSecondsTTLDefault
-                                      20,    // numDirectoryElementsToAllocate
-                                      NULL,  // pHashFunctionStructure
-                                      10,    // sizeCache
-                                      LeastRecentlyUsed,  // replacementPolicy
-                                      NULL); // pGlobalConfiguration
+    int iResult = pCache-&gt;Initialize (25 + 1, // lenMaxStringKey
+                                              // (25 characters + trailing NULL)
+                                      300,    // numSecondsTTLDefault
+                                      20,     // numDirectoryElementsToAllocate
+                                      NULL,   // pHashFunctionStructure
+                                      10,     // sizeCache
+                                      LeastRecentlyUsed, // replacementPolicy
+                                      NULL);  // pGlobalConfiguration
     if (iResult != E_SUCCESS)
     {
         // error handling here
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Glenn Hofford</dc:creator><pubDate>Wed, 14 Dec 2011 20:12:51 -0000</pubDate><guid>https://sourceforge.netfbc585ef23f8c52c8fc340e40c98dda82c032f95</guid></item><item><title>WikiPage Initialize Method modified by Glenn Hofford</title><link>https://sourceforge.net/p/perfcache/wiki/Initialize%2520Method/</link><description>&lt;pre&gt;--- v1 
+++ v2 
@@ -53,9 +53,7 @@
 &lt;br /&gt;
 ###### Remarks:######
 
-The Initialize() method is used to create and initialize a cache. This method also creates and initializes an internal Directory that is used by the cache. The Initialize() method
-creates a cache that only accepts byte (character) string keys; to use wide char string keys
-the InitializeEx() method must be used.
+The Initialize() method is used to create and initialize a cache. This method also creates and initializes an internal Directory that is used by the cache. The Initialize() method creates a cache that only accepts byte (character) string keys; to use wide char string keys the InitializeEx() method must be used.
 
 &lt;br /&gt;
 ###### Example ######
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Glenn Hofford</dc:creator><pubDate>Wed, 14 Dec 2011 20:05:47 -0000</pubDate><guid>https://sourceforge.net91b3f2b3df5c154a8f06b6fa13a878278b0553fb</guid></item><item><title>WikiPage Initialize Method modified by Glenn Hofford</title><link>https://sourceforge.net/p/perfcache/wiki/Initialize%2520Method/</link><description>##### Method: Cache::Initialize #####

###### Summary: ######

Initialize() creates and initializes a cache object.

&lt;br /&gt;
###### Syntax: ######

    int Initialize (unsigned int lenMaxStringKeyInUnits,
                    const unsigned int numSecondsTTLDefault,
                    const UINTEGER32 numDirectoryElementsToAllocate,
                    struct HashFunctionStructure *pHashFunctionStructure,
                    const UINTEGER32 sizeCache,
                    enum ReplacementPolicy replacementPolicy,
                    struct GlobalConfiguration *pGlobalConfiguration) = 0;

&lt;br /&gt;
###### Parameters:######

    1) lenMaxStringKeyInUnits: the maximum length of a key that is passed as a parameter
       to a basic operation method; for Initialize() this is a length in bytes. This value
       must include space for a null-terminator byte if one is needed. For example: if the
       max key length in bytes is 128, including space for a null terminator, 
       lenMaxStringKeyInUnits must be 128.

    2) numSecondsTTLDefault: the default Time-to-live (TTL) value.

    3) numDirectoryElementsToAllocate: (for the Directory, when instantiated as a hash
       table) - the size of the directory (map). A typical value would be 133% the size
       of the cache. (E.g. if cache size = 1000, this would be 1333).

    4) pHashFunctionStructure: this pointer must point to a HashFunctionStructure that has
        been initialized with a hash function.

    5) sizeCache: the number of entries (array elements) of the cache.

    6) replacementPolicy: LeastRecentlyUsed or LeastFrequentlyUsed.

    7) pGlobalConfiguration: a pointer to a GlobalConfiguration structure (this value may be
        NULL if custom global configuration settings are not needed).


&lt;br /&gt;
###### Return values:######

      E_INSUFFICIENTMEMORY
      E_KEY_INVALIDKEYTYPE
      E_CACHE_INITIALIZATION_CACHESIZE_TOO_SMALL
      E_CACHE_INITIALIZATION_INVALID_REPLACEMENTPOLICY
      E_SUCCESS

&lt;br /&gt;
###### Remarks:######

The Initialize() method is used to create and initialize a cache. This method also creates and initializes an internal Directory that is used by the cache. The Initialize() method
creates a cache that only accepts byte (character) string keys; to use wide char string keys
the InitializeEx() method must be used.

&lt;br /&gt;
###### Example ######

    Cache *pCache = NULL;

    try
    {
        pCache = Cache::CacheFactory();
    }
    catch (std::bad_alloc)
    {
        cout &lt;&lt; "Error: insufficient memory" &lt;&lt; endl;
    }

    pCache = Cache::CacheFactory();

    int iResult = pCache-&gt;Initialize (25,    // lenMaxStringKey
                                      300,   // numSecondsTTLDefault
                                      20,    // numDirectoryElementsToAllocate
                                      NULL,  // pHashFunctionStructure
                                      10,    // sizeCache
                                      LeastRecentlyUsed,  // replacementPolicy
                                      NULL); // pGlobalConfiguration
    if (iResult != E_SUCCESS)
    {
        // error handling here
    }
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Glenn Hofford</dc:creator><pubDate>Wed, 14 Dec 2011 20:03:36 -0000</pubDate><guid>https://sourceforge.neta8a6d43e11d1b4946c73f341d4c5e226ebfbea8d</guid></item></channel></rss>