Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions examples/TestingFunctions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

use phpFastCache\CacheManager;

// Include composer autoloader
require '../src/autoload.php';

if(!isset($InstanceCache)) {
$InstanceCache = CacheManager::getInstance();
}

function break_line() {
echo "<br><hr><br>";
}

function output($string) {
echo $string."\r\n<br>";
}
break_line();
$key = "key1";
output("Test Get");
$value = $InstanceCache->get($key);
output("{$key} = {$value}");
break_line();
output("Write Data 123456");
$InstanceCache->set($key,"123456",300);
break_line();
output("Read Data Again");
$value = $InstanceCache->get($key);
output("{$key} = {$value}");
break_line();
output("Delete Key");
$InstanceCache->delete($key);
$value = $InstanceCache->get($key);
output("{$key} = {$value}");
break_line();
output("Write Data 100");
$InstanceCache->set($key,100,300);
output("Increase by 10");
$InstanceCache->increment($key,10);
$value = $InstanceCache->get($key);
output("{$key} = {$value}");
output("Decrease by 10");
$InstanceCache->decrement($key,10);
$value = $InstanceCache->get($key);
output("{$key} = {$value}");
break_line();
output("Finished Testing, Caching is Working Good");
3 changes: 3 additions & 0 deletions examples/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@

echo '<br /><br /><a href="/">Back to index</a>&nbsp;--&nbsp;<a href="/' . basename(__FILE__) . '">Reload</a>';

// Testing Functions
require_once __DIR__."/TestingFunctions.php";

5 changes: 4 additions & 1 deletion examples/memcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use phpFastCache\CacheManager;

// Include composer autoloader
require '../vendor/autoload.php';
require '../src/autoload.php';

CacheManager::setup(array(
'memcache' => array(
Expand Down Expand Up @@ -53,3 +53,6 @@
}

echo '<br /><br /><a href="/">Back to index</a>&nbsp;--&nbsp;<a href="/' . basename(__FILE__) . '">Reload</a>';

// Testing Functions
require_once __DIR__."/TestingFunctions.php";
2 changes: 1 addition & 1 deletion examples/memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use phpFastCache\CacheManager;

// Include composer autoloader
require '../vendor/autoload.php';
require '../src/autoload.php';

CacheManager::setup(array(
'memcache' => array(
Expand Down
2 changes: 2 additions & 0 deletions examples/phpinfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
phpinfo();
3 changes: 3 additions & 0 deletions examples/predis.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@
}

echo '<br /><br /><a href="/">Back to index</a>&nbsp;--&nbsp;<a href="/' . basename(__FILE__) . '">Reload</a>';

// Testing Functions
require_once __DIR__."/TestingFunctions.php";
2 changes: 1 addition & 1 deletion tests/NewCacheInstance.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Testing memcached as it is declared in .travis.yml
*/
$driverInstance = CacheManager::getInstance('memcached');
$driverInstance = CacheManager::getInstance();

if(!is_object($driverInstance) || !($driverInstance instanceof DriverInterface))
{
Expand Down