<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to InsertCallerBuffer Method</title><link>https://sourceforge.net/p/perfcache/wiki/InsertCallerBuffer%2520Method/</link><description>Recent changes to InsertCallerBuffer Method</description><atom:link href="https://sourceforge.net/p/perfcache/wiki/InsertCallerBuffer%20Method/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 15 Dec 2011 01:15:40 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/perfcache/wiki/InsertCallerBuffer%20Method/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage InsertCallerBuffer Method modified by Glenn Hofford</title><link>https://sourceforge.net/p/perfcache/wiki/InsertCallerBuffer%2520Method/</link><description>&lt;pre&gt;--- v3 
+++ v4 
@@ -2,7 +2,7 @@
 
 ###### Summary: ######
 
-InsertCallerBuffer() copies cbData bytes from the buffer pointed to by pbData into a cache entry within the cache.
+InsertCallerBuffer() copies cbData bytes from the buffer pointed to by pbData into a cache entry within the cache. The cache does not allocate new memory for the data - it uses the buffer that the caller has allocated.
 
 &lt;br /&gt;
 ###### Syntax: ######
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Glenn Hofford</dc:creator><pubDate>Thu, 15 Dec 2011 01:15:40 -0000</pubDate><guid>https://sourceforge.nete564538a044a89a1115b4a22c2366ff1c001b996</guid></item><item><title>WikiPage InsertCallerBuffer Method modified by Glenn Hofford</title><link>https://sourceforge.net/p/perfcache/wiki/InsertCallerBuffer%2520Method/</link><description>&lt;pre&gt;--- v2 
+++ v3 
@@ -52,17 +52,16 @@
 &lt;br /&gt;
 ###### Example ######
 
-    char szVal  [26 + 1];
-
-    strcpy (szVal, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
-
-    // (note: in this case, the trailing NULL is inserted)
-
-    int iResult = pCache-&gt;Insert ((const QBYTE *)"Alphabet", // key
-                                  (QBYTE *) szVal,           // pbData (the value)
-                                  strlen(szVal)+1,           // cbData
-                                  0);                        // TTL
-
+    // the caller buffer:
+
+    QBYTE *pbBuffer = (QBYTE *) malloc (26 + 1);
+
+    strcpy ((char *) pbBuffer, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+    int iResult = pCache-&gt;InsertCallerBuffer ((const QBYTE *) "Alphabet", // key
+                                              pbBuffer, 
+                                              strlen ((char *) pbBuffer) + 1, // cbData
+                                              300);  // TTL
     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>Thu, 15 Dec 2011 01:14:43 -0000</pubDate><guid>https://sourceforge.net45a64fc53abf9864d122ecd6a1f6cb38f2dadb05</guid></item><item><title>WikiPage InsertCallerBuffer Method modified by Glenn Hofford</title><link>https://sourceforge.net/p/perfcache/wiki/InsertCallerBuffer%2520Method/</link><description>&lt;pre&gt;--- v1 
+++ v2 
@@ -43,7 +43,11 @@
 &lt;br /&gt;
 ###### Remarks:######
 
-The InsertCallerBuffer() method inserts a key and an associated value into the cache. If the cache is full, a replacement is performed; the type of replacement is dependent on the cache replacement policy.
+InsertCallerBuffer() is similar to the Insert() method. It differs as follows: InsertCallerBuffer() uses the caller-allocated buffer pointed to by pbData. The caller allocates a buffer of data, and passes a pointer in pbData. The cache will free the memory pointed to by pbData, during one of the following:
+
+   1) another Insert operation with duplicate key (where allowed), or Replace operation
+   2) a cache-directed replacement, during which a cache entry eviction takes place
+   3) during cleanup of the cache
 
 &lt;br /&gt;
 ###### Example ######
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Glenn Hofford</dc:creator><pubDate>Thu, 15 Dec 2011 01:09:42 -0000</pubDate><guid>https://sourceforge.net7f43cf91be04f327d82ae4ce93b7d71d9365b114</guid></item><item><title>WikiPage InsertCallerBuffer Method modified by Glenn Hofford</title><link>https://sourceforge.net/p/perfcache/wiki/InsertCallerBuffer%2520Method/</link><description>##### Method: Cache::InsertCallerBuffer #####

###### Summary: ######

InsertCallerBuffer() copies cbData bytes from the buffer pointed to by pbData into a cache entry within the cache.

&lt;br /&gt;
###### Syntax: ######

    int InsertCallerBuffer (const QBYTE *szKey, 
                            const QBYTE *pbData,
                            const size_t cbData,
                            const unsigned int numSecondsTTL);

    int InsertCallerBuffer (const QWORD *wszKey, 
                            const QBYTE *pbData,
                            const size_t cbData,
                            const unsigned int numSecondsTTL);

&lt;br /&gt;
###### Parameters:######

    1) szKey or wszKey: the key

    2) pbData: a pointer to a buffer of bytes that will be inserted into the cache. This
       buffer will have been allocated by the caller; the cache will free the memory pointed
       to by the buffer pointer.

    3) cbData: a count of bytes of the data. This value does not necessarily need to include
       space for a trailing NULL. Exactly cbData bytes of the buffer pointed to by pbData
       will be stored in the cache.

    4) numSecondsTTL: number of seconds for the "time-to-live" value.

&lt;br /&gt;
###### Return values:######

      E_KEY_INVALIDKEYTYPE
      E_INVALID_KEYVALUE
      E_CACHE_DUPLICATE_KEY_FOUND_ENTRY_NOT_REPLACED
      E_SUCCESS

&lt;br /&gt;
###### Remarks:######

The InsertCallerBuffer() method inserts a key and an associated value into the cache. If the cache is full, a replacement is performed; the type of replacement is dependent on the cache replacement policy.

&lt;br /&gt;
###### Example ######

    char szVal  [26 + 1];

    strcpy (szVal, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");

    // (note: in this case, the trailing NULL is inserted)

    int iResult = pCache-&gt;Insert ((const QBYTE *)"Alphabet", // key
                                  (QBYTE *) szVal,           // pbData (the value)
                                  strlen(szVal)+1,           // cbData
                                  0);                        // TTL

    if (iResult != E_SUCCESS)
    {
        // error handling here
    }
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Glenn Hofford</dc:creator><pubDate>Thu, 15 Dec 2011 00:53:36 -0000</pubDate><guid>https://sourceforge.net78e41ecfc534cd038c2ca4c937b7ea1a0a869bce</guid></item></channel></rss>