Skip to content

Commit 0ad02f4

Browse files
committed
Merge pull request #265 from khoaofgod/final
Testing Functions
2 parents 731e655 + 088601e commit 0ad02f4

File tree

7 files changed

+62
-3
lines changed

7 files changed

+62
-3
lines changed

examples/TestingFunctions.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
use phpFastCache\CacheManager;
4+
5+
// Include composer autoloader
6+
require '../src/autoload.php';
7+
8+
if(!isset($InstanceCache)) {
9+
$InstanceCache = CacheManager::getInstance();
10+
}
11+
12+
function break_line() {
13+
echo "<br><hr><br>";
14+
}
15+
16+
function output($string) {
17+
echo $string."\r\n<br>";
18+
}
19+
break_line();
20+
$key = "key1";
21+
output("Test Get");
22+
$value = $InstanceCache->get($key);
23+
output("{$key} = {$value}");
24+
break_line();
25+
output("Write Data 123456");
26+
$InstanceCache->set($key,"123456",300);
27+
break_line();
28+
output("Read Data Again");
29+
$value = $InstanceCache->get($key);
30+
output("{$key} = {$value}");
31+
break_line();
32+
output("Delete Key");
33+
$InstanceCache->delete($key);
34+
$value = $InstanceCache->get($key);
35+
output("{$key} = {$value}");
36+
break_line();
37+
output("Write Data 100");
38+
$InstanceCache->set($key,100,300);
39+
output("Increase by 10");
40+
$InstanceCache->increment($key,10);
41+
$value = $InstanceCache->get($key);
42+
output("{$key} = {$value}");
43+
output("Decrease by 10");
44+
$InstanceCache->decrement($key,10);
45+
$value = $InstanceCache->get($key);
46+
output("{$key} = {$value}");
47+
break_line();
48+
output("Finished Testing, Caching is Working Good");

examples/files.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@
6060

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

63+
// Testing Functions
64+
require_once __DIR__."/TestingFunctions.php";
65+

examples/memcache.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use phpFastCache\CacheManager;
2222

2323
// Include composer autoloader
24-
require '../vendor/autoload.php';
24+
require '../src/autoload.php';
2525

2626
CacheManager::setup(array(
2727
'memcache' => array(
@@ -53,3 +53,6 @@
5353
}
5454

5555
echo '<br /><br /><a href="/">Back to index</a>&nbsp;--&nbsp;<a href="/' . basename(__FILE__) . '">Reload</a>';
56+
57+
// Testing Functions
58+
require_once __DIR__."/TestingFunctions.php";

examples/memcached.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use phpFastCache\CacheManager;
2222

2323
// Include composer autoloader
24-
require '../vendor/autoload.php';
24+
require '../src/autoload.php';
2525

2626
CacheManager::setup(array(
2727
'memcache' => array(

examples/phpinfo.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
phpinfo();

examples/predis.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@
5656
}
5757

5858
echo '<br /><br /><a href="/">Back to index</a>&nbsp;--&nbsp;<a href="/' . basename(__FILE__) . '">Reload</a>';
59+
60+
// Testing Functions
61+
require_once __DIR__."/TestingFunctions.php";

tests/NewCacheInstance.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Testing memcached as it is declared in .travis.yml
1818
*/
19-
$driverInstance = CacheManager::getInstance('memcached');
19+
$driverInstance = CacheManager::getInstance();
2020

2121
if(!is_object($driverInstance) || !($driverInstance instanceof DriverInterface))
2222
{

0 commit comments

Comments
 (0)