PHP Classes

File: example/indexMemcache.php

Recommend this page to a friend!
  Classes of Muhammad Umer Farooq   PHP Simple Cache Library   example/indexMemcache.php   Download  
File: example/indexMemcache.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Simple Cache Library
Access data in different types of cache containers
Author: By
Last change:
Date: 5 years ago
Size: 800 bytes
 

Contents

Class file image Download
<?php

//load the class file
require_once 'init.php';
/* Memcache usage */

//connection
$mcache = new Lablnet\mcache('localhost', 11111);

//store
$mcache->store('name', 'Malik Umer Farooq', 0);
$mcache->store('age', '17', 0);
$mcache->store('email', 'lablnet01@gmail.org', 0);
//update
$mcache->update('email', 'lablnet01@gmail.com');

//replace
$mcache->replace('email', 'umer@gmail.com', 0);

//delete
$delete = $mcache->delete('email');

//get once record
var_dump($mcache->get('name'));

//get multiple records
echo '<br>';
var_dump($mcache->getMultiple(['name', 'age']));

//delete master its delete all data
//$mcache->deleteMaster();

//add new server
$mcache->addServer('localhost', 22222);

//version
$version = $mcache->version();

//finally close the server connection
$mcache->close();