Skip to content

Commit cb523fe

Browse files
authored
Merge pull request #606 from Geolim4/master
Fixed typo in readme & code sample mistakes.
2 parents 5ee3024 + ef4c194 commit cb523fe

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ Also please note that the V7 requires at least PHP7 or higher to work properly.
1010
Simple Yet Powerful PHP Caching Class
1111
---------------------------
1212
More information in [Wiki](https://github.com/PHPSocialNetwork/phpfastcache/wiki)
13-
One Class uses for All Cache. You don't need to rewrite your code many times again.
13+
The simplicity of abstraction: One class for many backend cache. You don't need to rewrite your code many times again.
1414

1515
### PHP7 Strict types enforced
1616
As of the V7 PhpFastCache enforces the php7 strict types to make sure that it's completely php7 compatible and is type aware.
17+
This ensure you that the library is completely reliable when it come to manipulate variable types.
1718

1819
### Supported drivers at this day *
1920
:bulb: Feel free to propose a driver by making a new **[Pull Request](https://github.com/PHPSocialNetwork/phpfastcache/compare)**, they are welcome !
@@ -36,16 +37,18 @@ As of the V7 PhpFastCache enforces the php7 strict types to make sure that it's
3637

3738
### Symfony/Drupal developers are not forgotten !
3839
Starting with v5, phpFastCache comes with a [Symfony Bundle](https://github.com/PHPSocialNetwork/phpfastcache-bundle).
39-
It's fresh, so feel free to report any bug or contribute to the project using pull requests.
40+
It is now a mature project Flex -ready, so feel free to give at try and report any bug (if any).
4041

4142
Also a [Drupal 8 Module](https://github.com/PHPSocialNetwork/phpfastcache-drupal) is currently in development, add it to your starred projects to get notified of the first public release.
4243

4344
---------------------------
4445
Not a "Traditional" Caching
4546
---------------------------
46-
phpFastCache is not like the traditional caching methods which keep reading and writing to files, sqlite or keeping open massive amounts of connections to memcache, redis, mongodb...
47-
Also, when you use high performances drivers, your miss hits will be drastically reduced.
48-
Slightly different from the usual caching libraries you will find everywhere on the internet, the phpFastCache library reduces the I/O and CPU load as much as possible.
47+
phpFastCache is not like the traditional caching methods which keep reading and writing to
48+
files, sqlite or keeping open massive amounts of connections to memcache, redis, mongodb...\
49+
Also, when you use high performances drivers, your miss hits will be drastically reduced.\
50+
Slightly different from the usual caching libraries you will find everywhere on the internet,
51+
the phpFastCache library reduces the I/O and CPU load as much as possible.
4952

5053
```php
5154
<?php
@@ -61,9 +64,10 @@ CacheManager::Files($config);
6164
Reduce Database/Webservice Calls
6265
---------------------------
6366

64-
Your website has 10,000 visitors who are online, and your dynamic page has to send 10,000 times the same queries to database or the webservice on every page load.
65-
With phpFastCache, your page only sends 1 query to your DB/WS, and uses the cache to serve the 9,999 other visitors.
66-
You can off course decide the TTL that will matches your needs.
67+
Your website has 10,000 visitors who are online, and your dynamic page has to send 10,000 times the same queries
68+
to database or the webservice on every page load.\
69+
With phpFastCache, your page only sends 1 query to your DB/WS, and uses the cache to serve the 9,999 other visitors.\
70+
You can obviously decide the TTL that will matches your needs.
6771

6872
---------------------------
6973
Rich Development API
@@ -274,13 +278,14 @@ composer require phpFastCache/phpFastCache
274278
```php
275279
<?php
276280
use Phpfastcache\CacheManager;
281+
use Phpfastcache\Config\ConfigurationOption;
277282

278283
// Setup File Path on your config files
279284
// Please note that as of the V6.1 the "path" config
280285
// can also be used for Unix sockets (Redis, Memcache, etc)
281-
CacheManager::setup(array(
282-
"path" => '/var/www/phpfastcache.com/dev/tmp', // or in windows "C:/tmp/"
283-
));
286+
CacheManager::setDefaultConfig(new ConfigurationOption([
287+
'path' => '/var/www/phpfastcache.com/dev/tmp', // or in windows "C:/tmp/"
288+
]));
284289

285290
// In your class, function, you can call the Cache
286291
$InstanceCache = CacheManager::getInstance('files');
@@ -296,18 +301,18 @@ $your_product_data = [
296301
'First product',
297302
'Second product',
298303
'Third product'
299-
// etc...
304+
/* ... */
300305
];
301306

302-
if (is_null($CachedString->get())) {
307+
if ($CachedString->isHit()) {
303308
$CachedString->set($your_product_data)->expiresAfter(5);//in seconds, also accepts Datetime
304309
$InstanceCache->save($CachedString); // Save the cache item just like you do with doctrine and entities
305310

306-
echo "FIRST LOAD // WROTE OBJECT TO CACHE // RELOAD THE PAGE AND SEE // ";
311+
echo 'FIRST LOAD // WROTE OBJECT TO CACHE // RELOAD THE PAGE AND SEE // ';
307312
echo $CachedString->get();
308313

309314
} else {
310-
echo "READ FROM CACHE // ";
315+
echo 'READ FROM CACHE // ';
311316
echo $CachedString->get()[0];// Will print 'First product'
312317
}
313318

0 commit comments

Comments
 (0)