Skip to content

Commit 63f9716

Browse files
committed
Updated docs and fixed typos
1 parent f6ac951 commit 63f9716

7 files changed

Lines changed: 16 additions & 65 deletions

File tree

docs/CREDITS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1919
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
SOFTWARE.
2121

22-
__Phpfastcache Current Project Manager:__ Georges.L (Geolim4) / (v5, v6, v7, v8)
22+
__Phpfastcache Current Project Manager:__ Georges.L (Geolim4) / (v5, v6, v7, v8, v9)
2323

24-
__Phpfastcache Former Project Founder:__ Khoa Bui (khoaofgod) / (<= v4)
24+
__Phpfastcache Former Project Founder:__ Khoa Bui (khoaofgod) / (> v4)
2525

2626
__Phpfastcache Contributors:__ https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors
2727

docs/OPTIONS.md

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,8 @@
1-
Phpfastcache has some options that you may want to know before using them, here's the list:
2-
3-
### File-based drivers options *
4-
* **path** See the "**Host/Authenticating options**" section
5-
* **default_chmod** _| int>octal (default: 0777)_ `[>=V4, <V7]` This option will define the chmod used to write driver cache files.
6-
* **defaultChmod** _| int>octal (default: 0777)_ `[>=V7]` New configuration name of `default_chmod` as of V7
7-
* **securityKey** _| string (default: 'auto')_ `[>=V4]` A security key that define the subdirectory name. 'auto' value will be the HTTP_HOST value.
8-
* **htaccess** _| bool (default: true)_ `[>=V4]` Option designed to (dis)allow the auto-generation of .htaccess.
9-
* **autoTmpFallback** _| bool (default: false)_ `[>=V6]`Option designed to automatically attempt to fall back to temporary directory if the cache fails to write on the specified directory
10-
* **secureFileManipulation** _| bool (default: false)_ `[>=V6]` This option enforces a strict I/O manipulation policy by adding more integrity checks. This option may slow down the write operations, therefore you must use it with caution. In case of failure a **PhpfastcacheIOException** exception will be thrown. Currently, only supported by _Files_ driver.
11-
* **cacheFileExtension** _| string (default: 'txt')_ `[>=V6.0.2]` This allows you to set up a custom (but safe) cache file extension.
12-
13-
\* Drivers like _Files_, _Sqlite_, _Leveldb_, etc.
1+
Phpfastcache has some options that you may want to know before using them.
142

153
### Global options
16-
* **fallback** _| string|bool_ (default: false)`[>=V4.2]` A driver name used in case the main driver stopped working. E.g. a missing php extension.
17-
* **fallbackConfig** _| ConfigurationOption|null_ (default: null)`[>=V7]` A dedicated `ConfigurationOption` object for the `fallback` driver, if needed.
18-
* **compress_data** _| bool (default: false)_ `[>=V4.3]` Compress stored data, if the backend supports it. Currently, only supported by _Memcache(d)_ driver.
19-
* **limited_memory_each_object** _| int (default: 4096)_ `[>=V4.2]` Maximum size (bytes) of object stored in memory. Currently, only supported by _Cookie_ driver.
20-
* **defaultTtl** _| int (default: 900)_ `[>=V5]` This option define a default ttl (time-to-live, in seconds) for item that has no specified expiration date/ttl.
21-
* **itemDetailedDate** _| bool (default: false)_ `[>=V6]` This option will define if the Items will make use of detailed dates such as Creation/modification date. Trying to access to these date without being explicitly enabled will throw a `LogicException`
22-
* **defaultKeyHashFunction** _| string (default: 'md5')_ `[>=V6]` This option will allow you to define a custom hash function for the `$item->getEncodedKey()` method. Callable objects are not allowed, but static method such as `\Absolute\Namespace\ToStatic::method` are allowed.
23-
* **defaultFileNameHashFunction** _| string (default: 'md5')_ `[>=V7]` This option will allow you to define a custom hash function for every I/O method that ends up to write an hashed filename on the disk.
24-
* **preventCacheSlams** _| bool (default: false)_ `[>=V6]` This option will allow you to prevent cache slams when making use of heavy cache items
25-
* **cacheSlamsTimeout** _| int (default: 15)_ `[>=V6]` This option defines the cache slams timeout in seconds
26-
* **useStaticItemCaching** _| bool(default: true)_ `[>=V8.0.3]` This option will allow you to disable the internal static storage of cache items. Can be used for cron script that loop indefinitely on cache items to avoid calling `detachAllItems()`/`detachItem($item)` from the cache pool.
27-
* **superGlobalAccessor** _| object|\Closure(default: null)_ `[>= V9]` This option will allow you to define how Phpfastcache should access to superglobal variables. The object given MUST be **invokable**. Look `\Phpfastcache\Config\ConfigurationOption::getDefaultSuperGlobalAccessor()` for default behavior
28-
29-
### Host/Authenticating options *
30-
* **host** _| string (default: null)_ The hostname
31-
* **path** _| string (default: null|string[temp. dir.])_ `[>=V4], [>=V6.1]` The absolute path where the written cache files belong to (system temp directory by default). **As of the V6.1** this option is also used to define (P)redis and Memcache(d) UNIX socket
32-
* **port** _| int (default: null)_ The port
33-
* **username** _| string (default: null)_ The username
34-
* **password** _| string (default: null)_ The password
35-
* **timeout** _| int (default: null)_ The timeout (in seconds)
36-
* **servers** _| array (default: null)_ Array of servers. Exclusive to Memcache(d)
37-
38-
### Redis/Predis specific options
39-
* **redisClient** _| \Redis (default: null)_ `[>=V7]` An optional Redis Client created outside Phpfastcache's scope. This option overrides every _Host/Authenticating_ options
40-
* **predisClient** _| \Predis\Client (default: null)_ `[>=V7]` An optional Predis Client created outside Phpfastcache's scope. This option overrides every _Host/Authenticating_ options
41-
42-
These options differ depend on the driver that you are using, see **/Examples** folder for more information about these options.
43-
44-
\* Drivers like _CouchBase_, _MongoDb_, _(P)redis_, _Ssdb_, etc.
4+
The global options are defined in `\Phpfastcache\Config\ConfigurationOption` ([ConfigurationOption.php](../lib/Phpfastcache/Config/ConfigurationOption.php))
455

6+
### Driver-specific options *
7+
The driver-specific options are defined in `Config.php` file located in each driver [directory](../lib/Phpfastcache/Drivers).
8+
Each driver-specific `Config` class file extends `\Phpfastcache\Config\ConfigurationOption`

lib/Phpfastcache/CacheContract.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,12 @@
2121

2222
class CacheContract
2323
{
24-
25-
26-
27-
28-
29-
30-
31-
3224
protected CacheItemPoolInterface $cacheInstance;
3325

34-
3526
public function __construct(CacheItemPoolInterface $cacheInstance)
3627
{
3728
$this->cacheInstance = $cacheInstance;
38-
}//end __construct()
39-
29+
}
4030

4131
/**
4232
* @param string $cacheKey
@@ -51,8 +41,7 @@ public function get(string $cacheKey, callable $callback, DateInterval|int $expi
5141

5242
if (! $cacheItem->isHit()) {
5343
/*
54-
*
55-
* Parameter $cacheItem will be available as of 8.0.6
44+
* Parameter $cacheItem will be available as of 8.0.6
5645
*/
5746
$cacheItem->set($callback($cacheItem));
5847
if ($expiresAfter) {
@@ -63,11 +52,10 @@ public function get(string $cacheKey, callable $callback, DateInterval|int $expi
6352
}
6453

6554
return $cacheItem->get();
66-
}//end get()
67-
55+
}
6856

6957
public function __invoke(...$args): mixed
7058
{
7159
return $this->get(...$args);
72-
}//end __invoke()
60+
}
7361
}

lib/Phpfastcache/Drivers/Apcu/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function driverClear(): bool
118118
return @apcu_clear_cache();
119119
}
120120

121-
public function getConfig() : Config|ConfigurationOption
121+
public function getConfig(): Config
122122
{
123123
return $this->config;
124124
}

lib/Phpfastcache/Drivers/Arangodb/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public function getStats(): DriverStatistic
311311
->setSize($rawData['collectionCount']);
312312
}
313313

314-
public function getConfig() : Config
314+
public function getConfig(): Config
315315
{
316316
return $this->config;
317317
}

lib/Phpfastcache/Drivers/Dynamodb/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ protected function decodeDocument(array $data): array
279279
return $data;
280280
}
281281

282-
public function getConfig() : Config
282+
public function getConfig(): Config
283283
{
284284
return $this->config;
285285
}

lib/Phpfastcache/Proxy/PhpfastcacheAbstractProxy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use Phpfastcache\Exceptions\PhpfastcacheDriverCheckException;
2626
use Phpfastcache\Exceptions\PhpfastcacheDriverException;
2727
use Phpfastcache\Exceptions\PhpfastcacheDriverNotFoundException;
28-
use Phpfastcache\Exceptions\PhpfastcacheInvalidArgumentException;
28+
use Phpfastcache\Exceptions\PhpfastcacheLogicException;
2929
use Psr\Cache\CacheItemInterface;
3030

3131
/**
@@ -86,7 +86,7 @@ abstract class PhpfastcacheAbstractProxy
8686
* @throws PhpfastcacheDriverCheckException
8787
* @throws PhpfastcacheDriverException
8888
* @throws PhpfastcacheDriverNotFoundException
89-
* @throws PhpfastcacheInvalidArgumentException
89+
* @throws PhpfastcacheLogicException
9090
*/
9191
public function __construct(string $driver, $config = null)
9292
{

0 commit comments

Comments
 (0)