I think the question is, what do you wish to do? As PHP is an interpreted language, it must compile an intermediate object to be ran, and storing that in a memory cache (it may directly store it in a tmpfs within the shared memory, on Linux, being /dev/shm) will increase the performance of scripts. As mentioned, the simplicity of an admin interface to handle the storage/flushing of web page objects, is the most common use case and requires little intervention/no programming, with great gain in performance.
If you are referring to the API to leverage its use for other means, there is nowhere better to start than the PHP manual: http://php.net/manua...k.memcached.php
There you will find functions to connect to the local memcached server through libmemcached, store objects in shared memory if need be, and retrieve them. You will have to have a script, or objects, which can benefit from having such a library and service however and I cannot personally find too much off the top of my head.
If you are spitting out a huge database list or similar as I gather from your guys' database speak, website caching through the appropriate HTTP headers for example is a common method of preserving database loading by having them load static content, or taking advantage of the appropriate caching techniques your database actually provides (i.e. SELECT caching with MySQL http://dev.mysql.com...uery-cache.html ), or a relational database containing these features if there are any available.
If you are using memcached for this, for an exercise, or however, then simply checking if the content is cached through the method ->get('desired key')is not false, you can send the user that content instead of anything within the if statement (such as opening a database connection, or file, whatever it may be.) from shared memory.
echo "Some dynamic content: " . time();
$retrieved = $memcached->get('something');
if($retrieved === false) {
//do intensive stuff, load a file, do query ...'
$data = file_get_contents('foobar.txt');
$memcached->set('something', $data, $expiration);
}
echo "\nSome possibly static content: ";
echo $retrieved;
Do these help any?
Alexander.
Edited by Alexander, 23 July 2014 - 06:04 AM.