Skip to content

Commit b15aa6c

Browse files
committed
Updated examples as per #612
1 parent 5aa4726 commit b15aa6c

File tree

12 files changed

+37
-34
lines changed

12 files changed

+37
-34
lines changed

docs/examples/SaveMultiple.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
// OR require_once("../src/phpFastCache/phpFastCache.php");
1717

1818
use Phpfastcache\CacheManager;
19+
use Phpfastcache\Config\Config;
1920

2021
// Setup File Path on your config files
21-
CacheManager::setDefaultConfig([
22+
CacheManager::setDefaultConfig(new Config([
2223
"path" => sys_get_temp_dir()
23-
]);
24+
]));
2425

2526
// In your class, function, you can call the Cache
2627
$InstanceCache = CacheManager::getInstance('files');

docs/examples/cassandra.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414

1515
use Phpfastcache\CacheManager;
16+
use Phpfastcache\Drivers\Cassandra\Config;
1617

1718
// Include composer autoloader
1819
require __DIR__ . '/../../vendor/autoload.php';
@@ -26,7 +27,7 @@
2627
$config['sslEnabled'] = false;
2728
$config['sslVerify'] = false;
2829

29-
$InstanceCache = CacheManager::getInstance('cassandra', $config);
30+
$InstanceCache = CacheManager::getInstance('cassandra', new Config($config));
3031

3132
/**
3233
* Try to get $products from Caching First

docs/examples/couchbase.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,18 @@
1313
*/
1414

1515
use Phpfastcache\CacheManager;
16+
use Phpfastcache\Drivers\Couchbase\Config;
1617

1718
// Include composer autoloader
1819
require __DIR__ . '/../../vendor/autoload.php';
1920

20-
$InstanceCache = CacheManager::getInstance('couchbase', [
21+
$InstanceCache = CacheManager::getInstance('couchbase', new Config([
2122
'host' => 'your-couchbase-host',
2223
'port' => '8091',
2324
'username' => 'your-couchbase-username',
2425
'password' => 'your-couchbase-password',
25-
'buckets' => [
26-
[
27-
'bucket' => 'default', // The bucket name, generally "default" by default
28-
'password' => '' // The bucket password if there is
29-
],
30-
]
31-
]);
26+
'bucketName' => 'default' // The bucket name, generally "default" by default
27+
]));
3228

3329
/**
3430
* Try to get $products from Caching First

docs/examples/couchdb.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@
1313
*/
1414

1515
use Phpfastcache\CacheManager;
16+
use Phpfastcache\Drivers\Couchdb\Config;
1617

1718
// Include composer autoloader
1819
require __DIR__ . '/../../vendor/autoload.php';
1920

20-
$InstanceCache = CacheManager::getInstance('couchdb', [
21+
$InstanceCache = CacheManager::getInstance('couchdb', new Config([
2122
'host' => '127.0.0.1',
2223
'port' => 5984,
2324
'path' => '/',
2425
'username' => 'your-couchdb-username',
2526
'password' => 'your-couchdb-password',
2627
'ssl' => true,
2728
'timeout' => 10,
28-
]);
29+
]));
2930

3031
/**
3132
* Try to get $products from Caching First

docs/examples/files.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919

2020
use Phpfastcache\CacheManager;
21+
use Phpfastcache\Config\Config;
2122
use Phpfastcache\Core\phpFastCache;
2223

2324
// Setup File Path on your config files
24-
CacheManager::setDefaultConfig([
25+
CacheManager::setDefaultConfig(new Config([
2526
"path" => sys_get_temp_dir(),
2627
"itemDetailedDate" => false
27-
]);
28+
]));
2829

2930
// In your class, function, you can call the Cache
3031
$InstanceCache = CacheManager::getInstance('files');

docs/examples/leveldb.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818

1919

2020
use Phpfastcache\CacheManager;
21+
use Phpfastcache\Config\Config;
2122
use Phpfastcache\Core\phpFastCache;
2223

2324
// Setup File Path on your config files
24-
CacheManager::setDefaultConfig([
25+
CacheManager::setDefaultConfig(new Config([
2526
"path" => sys_get_temp_dir(),
26-
]);
27+
]));
2728

2829
// In your class, function, you can call the Cache
2930
$InstanceCache = CacheManager::getInstance('leveldb');

docs/examples/memcache.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,17 @@
1313
*/
1414

1515
use Phpfastcache\CacheManager;
16+
use Phpfastcache\Drivers\Memcache\Config;
1617

1718
// Include composer autoloader
1819
require __DIR__ . '/../../src/autoload.php';
1920

20-
$InstanceCache = CacheManager::getInstance('memcache', ['servers' => [
21-
[
21+
$InstanceCache = CacheManager::getInstance('memcache',new Config([
2222
'host' =>'127.0.0.1',
2323
'port' => 11211,
24-
// 'sasl_user' => false, // optional
25-
// 'sasl_password' => false // optional
26-
],
27-
]]);
24+
// 'sasl_user' => false, // optional
25+
// 'sasl_password' => false // optional
26+
]));
2827

2928
/**
3029
* In case you need to enable compress_data option:

docs/examples/memcached.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,17 @@
1313
*/
1414

1515
use Phpfastcache\CacheManager;
16+
use Phpfastcache\Drivers\Memcached\Config;
1617

1718
// Include composer autoloader
1819
require __DIR__ . '/../../vendor/autoload.php';
1920

20-
$InstanceCache = CacheManager::getInstance('memcached', ['servers' => [
21-
[
21+
$InstanceCache = CacheManager::getInstance('memcached', new Config([
2222
'host' =>'127.0.0.1',
2323
'port' => 11211,
2424
// 'sasl_user' => false, // optional
2525
// 'sasl_password' => false // optional
26-
],
27-
]]);
26+
]));
2827

2928
/**
3029
* In case you need SASL authentication:

docs/examples/predis.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
*/
1414

1515
use Phpfastcache\CacheManager;
16+
use Phpfastcache\Drivers\Predis\Config;
1617

1718
// Include composer autoloader
1819
require __DIR__ . '/../../vendor/autoload.php';
1920

20-
$InstanceCache = CacheManager::getInstance('predis', [
21+
$InstanceCache = CacheManager::getInstance('predis', new Config([
2122
'host' => '127.0.0.1', //Default value
2223
'port' => 6379, //Default value
2324
'password' => null, //Default value
2425
'database' => null, //Default value
25-
]);
26+
]));
2627

2728
/**
2829
* Try to get $products from Caching First

docs/examples/redis.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
*/
1414

1515
use Phpfastcache\CacheManager;
16+
use Phpfastcache\Drivers\Redis\Config;
1617

1718
// Include composer autoloader
1819
require __DIR__ . '/../../vendor/autoload.php';
1920

20-
$InstanceCache = CacheManager::getInstance('redis', [
21+
$InstanceCache = CacheManager::getInstance('redis', new Config([
2122
'host' => '127.0.0.1', //Default value
2223
'port' => 6379, //Default value
2324
'password' => null, //Default value
2425
'database' => null, //Default value
25-
]);
26+
]));
2627

2728
/**
2829
* Try to get $products from Caching First

0 commit comments

Comments
 (0)