diff --git a/reference/memcache/functions/Memcache-add.xml b/reference/memcache/functions/Memcache-add.xml
new file mode 100644
index 0000000000..f761e46bf9
--- /dev/null
+++ b/reference/memcache/functions/Memcache-add.xml
@@ -0,0 +1,78 @@
+
+
+
+
+ Memcache::add
+ Add an item to the server
+
+
+ Description
+
+ boolMemcache::add
+ stringkey
+ mixedvar
+ intflag
+ intexpire
+
+
+ Memcache::add stores variable
+ var with key only if such
+ key doesn't exist at the server yet.
+ Memcache::add returns &false; if such key already
+ exist. For the rest Memcache::add behaves
+ similarly to Memcache::set.
+
+
+ Also you can use memcache_add function.
+ See example below.
+
+
+ Memcache::add example
+
+add('var_key', 'test variable', false, 30);
+
+?>
+]]>
+
+
+
+ Memcache::add returns &true; on success or &false;
+ on failure.
+
+
+ See also
+ Memcache::set,
+ Memcache::replace.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-close.xml b/reference/memcache/functions/Memcache-close.xml
new file mode 100644
index 0000000000..e51d324a25
--- /dev/null
+++ b/reference/memcache/functions/Memcache-close.xml
@@ -0,0 +1,78 @@
+
+
+
+
+ Memcache::close
+ Close memcached server connection
+
+
+ Description
+
+ boolMemcache::close
+
+
+
+ Memcache::close closes connection to memcached
+ server. This function doesn't close persistent connections, which are
+ closed only during web-server shutdown/restart.
+
+
+ Also you can use memcache_close function.
+ See example below.
+
+
+ Memcache::close example
+
+connect('memcache_host', 11211);
+/*
+do something here ..
+*/
+$memcache_obj->close();
+
+?>
+]]>
+
+
+
+ Memcache::close returns &false; if an error occured.
+
+
+ See also
+ Memcache::connect,
+ Memcache::pconnect.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-connect.xml b/reference/memcache/functions/Memcache-connect.xml
new file mode 100644
index 0000000000..956a4d575d
--- /dev/null
+++ b/reference/memcache/functions/Memcache-connect.xml
@@ -0,0 +1,86 @@
+
+
+
+
+ Memcache::connect
+ Open memcached server connection
+
+
+ Description
+
+ boolMemcache::connect
+ stringhost
+ intport
+ inttimeout
+
+
+ Memcache::connect establishes a connection to the
+ memcached server. Parameters host and
+ port point to the host and port, where
+ memcached is listening for connections.
+ Parameter port is optional, it's default value is
+ 11211. Also you can define a timeout, which will be
+ used when connecting to the daemon. Think twice before changing the default
+ value - you can loose all the advantages of caching if your connection is too
+ slow.
+
+
+ The connection, which was opened using
+ Memcache::connect will be automatically closed at the
+ end of script execution. Also you can close it with
+ Memcache::close.
+
+
+ Also you can use memcache_connect function.
+ See example below.
+
+
+ Memcache::connect example
+
+connect('memcache_host', 11211);
+
+?>
+]]>
+
+
+
+ &return.success;
+
+
+ See also
+ Memcache::pconnect and
+ Memcache::close.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-decrement.xml b/reference/memcache/functions/Memcache-decrement.xml
new file mode 100644
index 0000000000..5b91e0dc4a
--- /dev/null
+++ b/reference/memcache/functions/Memcache-decrement.xml
@@ -0,0 +1,96 @@
+
+
+
+
+ Memcache::decrement
+ Decrement item's value
+
+
+ Description
+
+ intMemcache::decrement
+ stringkey
+ intvalue
+
+
+ Memcache::decrement decrements value of the
+ item by value. Similarly to
+ Memcache::increment, current value of the item is
+ being converted to numerical and after that value
+ is substracted.
+
+
+ Parameter value is optional. It's default is 1.
+
+
+
+ New item's value will not be less than zero.
+
+
+
+
+ Do not use Memcache::decrement with item, which was
+ stored compressed, because consequent call to
+ Memcache::get will fail.
+
+
+
+ Also you can use memcache_decrement function.
+ See example below.
+
+
+ Memcache::decrement example
+
+connect('memcache_host', 11211);
+/* decrement item by 3 */
+$new_value = $memcache_obj->decrement('test_item', 3);
+?>
+]]>
+
+
+
+ Memcache::decrement does not
+ create an item if it didn't exist.
+
+
+ Memcache::decrement returns item's new value on
+ success or &false; on failure.
+
+
+ See also
+ Memcache::increment,
+ Memcache::replace.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-delete.xml b/reference/memcache/functions/Memcache-delete.xml
new file mode 100644
index 0000000000..d2471c101b
--- /dev/null
+++ b/reference/memcache/functions/Memcache-delete.xml
@@ -0,0 +1,70 @@
+
+
+
+
+ Memcache::delete
+ Delete item from the server
+
+
+ Description
+
+ boolMemcache::delete
+ stringkey
+ inttimeout
+
+
+ Memcache::delete deletes item with the
+ key. If parameter timeout
+ is specified, the item will expire after
+ timeout seconds.
+
+
+ Also you can use memcache_delete function.
+ See example below.
+
+
+ Memcache::delete example
+
+connect('memcache_host', 11211);
+
+?>
+]]>
+
+
+
+ &return.success;
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-flush.xml b/reference/memcache/functions/Memcache-flush.xml
new file mode 100644
index 0000000000..116e39e8df
--- /dev/null
+++ b/reference/memcache/functions/Memcache-flush.xml
@@ -0,0 +1,71 @@
+
+
+
+
+ Memcache::flush
+ Flush all existing items at the server
+
+
+ Description
+
+ boolMemcache::flush
+
+
+
+ Memcache::flush immediately invalidates all
+ existing items. Memcache::flush doesn't
+ actually free any resources, it only marks all the items as expired, so
+ occupied memory will be overwritten by new items.
+
+
+ Also you can use memcache_flush function.
+ See example below.
+
+
+ Memcache::flush example
+
+connect('memcache_host', 11211);
+
+$memcache_obj->flush();
+
+?>
+]]>
+
+
+
+ &return.success;
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-get.xml b/reference/memcache/functions/Memcache-get.xml
new file mode 100644
index 0000000000..460a3e3da5
--- /dev/null
+++ b/reference/memcache/functions/Memcache-get.xml
@@ -0,0 +1,63 @@
+
+
+
+
+ Memcache::get
+ Retrieve item from the server
+
+
+ Description
+
+ mixedMemcache::get
+ stringkey
+
+
+ Memcache::get returns previously stored data if
+ an item with such key exists on the server at this
+ moment.
+
+
+ Memcache::get example
+
+connect('memcache_host', 11211);
+$var = $memcache_obj->get('some_key');
+
+?>
+]]>
+
+
+
+ Memcache::get returns &false; on failure.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-getStats.xml b/reference/memcache/functions/Memcache-getStats.xml
new file mode 100644
index 0000000000..d2916450e0
--- /dev/null
+++ b/reference/memcache/functions/Memcache-getStats.xml
@@ -0,0 +1,52 @@
+
+
+
+
+ Memcache::getStats
+ Get statistics of the server
+
+
+ Description
+
+ arrayMemcache::getStats
+
+
+
+ Memcache::getStats returns an associative array
+ with server's statistics. Array keys correspond to stats parameters and
+ values to parameter's values.
+
+
+ Also you can use memcache_get_stats function.
+
+
+ Memcache::getStats returns &false; in case of an
+ error.
+
+
+ See also
+ Memcache::getVersion.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-getVersion.xml b/reference/memcache/functions/Memcache-getVersion.xml
new file mode 100644
index 0000000000..d9e5199a69
--- /dev/null
+++ b/reference/memcache/functions/Memcache-getVersion.xml
@@ -0,0 +1,71 @@
+
+
+
+
+ Memcache::getVersion
+ Return version of the server
+
+
+ Description
+
+ stringMemcache::getVersion
+
+
+
+ Memcache::getVersion returns a string with server's
+ version number.
+
+
+ Also you can use memcache_get_version function.
+ See example below.
+
+
+ Memcache::getVersion example
+
+getVersion();
+
+?>
+]]>
+
+
+
+ Memcache::getVersion returns &false; if an error
+ occured.
+
+
+ See also
+ Memcache::getStats.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-increment.xml b/reference/memcache/functions/Memcache-increment.xml
new file mode 100644
index 0000000000..aebd9c6d92
--- /dev/null
+++ b/reference/memcache/functions/Memcache-increment.xml
@@ -0,0 +1,92 @@
+
+
+
+
+ Memcache::increment
+ Increment item's value
+
+
+ Description
+
+ intMemcache::increment
+ stringkey
+ intvalue
+
+
+ Memcache::increment increments value of the item on
+ the specified value. If item with key
+ key was not numeric and cannot be converted to
+ number, it will change it's value to value.
+
+
+ Parameter value is optional. It's default value is
+ 1.
+
+
+
+ Do not use Memcache::increment with item, which was
+ stored compressed, because consequent call to
+ Memcache::get will fail.
+
+
+
+ Also you can use memcache_increment function.
+ See example below.
+
+
+ Memcache::increment example
+
+connect('memcache_host', 11211);
+/* increment counter by 3 */
+$current_value = $memcache_obj->increment('counter', 3);
+
+?>
+]]>
+
+
+
+ Memcache::increment returns new item's value on
+ success or &false; on failure.
+
+
+ Memcache::increment does not
+ create an item if it didn't exist.
+
+
+ See also
+ Memcache::decrement,
+ Memcache::replace.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-pconnect.xml b/reference/memcache/functions/Memcache-pconnect.xml
new file mode 100644
index 0000000000..85d4733967
--- /dev/null
+++ b/reference/memcache/functions/Memcache-pconnect.xml
@@ -0,0 +1,74 @@
+
+
+
+
+ Memcache::pconnect
+ Open memcached server persistent connection
+
+
+ Description
+
+ boolMemcache::pconnect
+ stringhost
+ intport
+ inttimeout
+
+
+ Memcache::pconnect is similar to
+ Memcache::connect with the difference, that
+ the connection it establishes is persistent.
+ This connection is not closed after the end of script execution and
+ by Memcache::close function.
+
+
+ Also you can use memcache_pconnect function.
+ See example below.
+
+
+ Memcache::pconnect example
+
+pconnect('memcache_host', 11211);
+
+?>
+]]>
+
+
+
+ &return.success;
+
+
+ See also
+ Memcache::connect.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-replace.xml b/reference/memcache/functions/Memcache-replace.xml
new file mode 100644
index 0000000000..e087b9c162
--- /dev/null
+++ b/reference/memcache/functions/Memcache-replace.xml
@@ -0,0 +1,76 @@
+
+
+
+
+ Memcache::replace
+ Replace value of the existing item
+
+
+ Description
+
+ boolMemcache::replace
+ stringkey
+ mixedvar
+ intflag
+ intexpire
+
+
+ Memcache::replace should be used to replace value of
+ existing item with key. In case if item with such
+ key doesn't exists, Memcache::replace returns
+ &false;. For the rest Memcache::replace behaves
+ similarly to Memcache::set.
+
+
+ Also you can use memcache_replace function.
+ See example below.
+
+
+ Memcache::replace example
+
+replace("test_key", "some variable", false, 30);
+
+?>
+]]>
+
+
+
+ &return.success;
+
+
+ See also
+ Memcache::set,
+ Memcache::add.
+
+
+
+
+
diff --git a/reference/memcache/functions/Memcache-set.xml b/reference/memcache/functions/Memcache-set.xml
new file mode 100644
index 0000000000..476cd609ab
--- /dev/null
+++ b/reference/memcache/functions/Memcache-set.xml
@@ -0,0 +1,118 @@
+
+
+
+
+ Memcache::set
+ Store data at the server
+
+
+ Description
+
+ boolMemcache::set
+ stringkey
+ mixedvar
+ intflag
+ intexpire
+
+
+ Memcache::set stores an item
+ var with key on the
+ memcached server. Parameter expire is expiration
+ time in seconds. If it's 0, the item never expires (but memcached server
+ doesn't guarantee this item to be stored all the time, it could be deleted
+ from the cache to make place for other items).
+
+
+ You can use MEMCACHE_COMPRESSED constant as
+ flag value if you want to use on-the-fly
+ compression (uses zlib).
+
+
+ Also you can use memcache_set function.
+ See example below.
+
+
+
+ Remember that resource variables (i.e. file and connection descriptors)
+ cannot be stored in the cache, because they cannot be adequately
+ represented in serialized state.
+
+
+
+ Memcache::set example
+
+
+]]>
+
+
+
+ Memcache::set example
+
+connect('memcache_host', 11211);
+
+/*
+set value of item with key 'var_key', using on-the-fly compression
+expire time is 50 seconds
+*/
+$memcache_obj->set('var_key', 'some really big variable', MEMCACHE_COMPRESSED, 50);
+
+echo $memcache_obj->get('var_key');
+
+?>
+]]>
+
+
+
+ &return.success;
+
+
+ See also
+ Memcache::add,
+ Memcache::replace.
+
+
+
+
+
diff --git a/reference/memcache/functions/memcache_debug.xml b/reference/memcache/functions/memcache_debug.xml
new file mode 100644
index 0000000000..9f57a7a592
--- /dev/null
+++ b/reference/memcache/functions/memcache_debug.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ memcache_debug
+ Turn debug output on/off
+
+
+ Description
+
+ boolmemcache_debug
+ inton_off
+
+
+ memcache_debug turns on debug output if parameter
+ on_off is equal to 1 and turns off if it's 0.
+
+
+
+ memcache_debug is accessible only if PHP was built
+ with --enable-debug option and always returns &true; in this case.
+ Otherwise, this function has no effect and always returns &false;.
+
+
+
+
+
+
diff --git a/reference/memcache/reference.xml b/reference/memcache/reference.xml
new file mode 100644
index 0000000000..378d1fef6e
--- /dev/null
+++ b/reference/memcache/reference.xml
@@ -0,0 +1,156 @@
+
+
+
+ Memcache Functions
+ Memcache
+
+
+
+ &reftitle.intro;
+
+ Memcache module provides handy procedural and object oriented interface
+ to memcached, highly effective caching daemon, which was especially
+ designed to decrease database load in dynamic web applications.
+
+
+ More information about memcached can be found at &url.memcached;.
+
+
+
+
+ &reftitle.required;
+
+ This module uses functions of zlib
+ to support on-the-fly data compression. Zlib is required to install
+ this module.
+
+
+ PHP 4.3.3 or newer is required to use memcache extension.
+
+
+
+
+ &reftitle.install;
+
+ Memcache is currently available through PECL
+ &url.pecl.package;memcache.
+
+
+ Also you can use the pear installer to install the memcache extension,
+ using the following command: pear -v install memcache.
+
+
+ You can always download the tar.gz package and install memcache by hand:
+
+ Memcache installation
+
+
+
+
+
+
+ Windows users can download the extension dll php_memcache.dll
+ here: &url.pecl.get.win;.
+
+
+
+
+ &reftitle.resources;
+
+ There is only one resource type used in memcache module - it's
+ the link identifier for a cache server connection.
+
+
+
+
+ &reftitle.constants;
+
+
+
+ MEMCACHE_COMPRESSED
+ (integer)
+
+
+
+ Used to turn on-the-fly data compression on with
+ Memcache::set, Memcache::add
+ and Memcache::replace.
+
+
+
+
+
+
+
+ &reftitle.examples;
+
+
+ memcache extension overview example
+
+connect('localhost', 11211) or die ("Could not connect");
+
+$version = $memcache->getVersion();
+echo "Server's version: ".$version."
\n";
+
+$tmp_object = new stdClass;
+$tmp_object->str_attr = 'test';
+$tmp_object->int_attr = 123;
+
+$memcache->set('key', $tmp_object, 10) or die ("Failed to save data at the server");
+echo "Store data in the cache (data will expire in 10 seconds)
\n";
+
+$get_result = $memcache->get('key');
+echo "Data from the cache:
\n";
+
+var_dump($get_result);
+
+?>
+]]>
+
+
+
+
+ In the above example, an object is being saved in the cache and then
+ retrieved back. Object and other non-scalar types are serialized before
+ saving, so it's impossible to store resources (i.e. connection identifiers
+ and others) in the cache.
+
+
+
+
+
+ &reference.memcache.functions;
+
+
+
+