@@ -27,34 +27,34 @@ |
||
27 | 27 | */ |
28 | 28 | class Item implements ExtendedCacheItemInterface |
29 | 29 | { |
30 | - use ItemBaseTrait { |
|
31 | - ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Item constructor. |
|
36 | - * @param Driver $driver |
|
37 | - * @param $key |
|
38 | - * @throws PhpfastcacheInvalidArgumentException |
|
39 | - */ |
|
40 | - public function __construct(MemstaticDriver $driver, $key) |
|
41 | - { |
|
42 | - $this->__BaseConstruct($driver, $key); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @param ExtendedCacheItemPoolInterface $driver |
|
47 | - * @return static |
|
48 | - * @throws PhpfastcacheInvalidArgumentException |
|
49 | - */ |
|
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
52 | - if ($driver instanceof MemstaticDriver) { |
|
53 | - $this->driver = $driver; |
|
54 | - |
|
55 | - return $this; |
|
56 | - } |
|
57 | - |
|
58 | - throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | - } |
|
30 | + use ItemBaseTrait { |
|
31 | + ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Item constructor. |
|
36 | + * @param Driver $driver |
|
37 | + * @param $key |
|
38 | + * @throws PhpfastcacheInvalidArgumentException |
|
39 | + */ |
|
40 | + public function __construct(MemstaticDriver $driver, $key) |
|
41 | + { |
|
42 | + $this->__BaseConstruct($driver, $key); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @param ExtendedCacheItemPoolInterface $driver |
|
47 | + * @return static |
|
48 | + * @throws PhpfastcacheInvalidArgumentException |
|
49 | + */ |
|
50 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | + { |
|
52 | + if ($driver instanceof MemstaticDriver) { |
|
53 | + $this->driver = $driver; |
|
54 | + |
|
55 | + return $this; |
|
56 | + } |
|
57 | + |
|
58 | + throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @param $key |
38 | 38 | * @throws PhpfastcacheInvalidArgumentException |
39 | 39 | */ |
40 | - public function __construct(MemstaticDriver $driver, $key) |
|
41 | - { |
|
40 | + public function __construct(MemstaticDriver $driver, $key) { |
|
42 | 41 | $this->__BaseConstruct($driver, $key); |
43 | 42 | } |
44 | 43 | |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * @return static |
48 | 47 | * @throws PhpfastcacheInvalidArgumentException |
49 | 48 | */ |
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
49 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) { |
|
52 | 50 | if ($driver instanceof MemstaticDriver) { |
53 | 51 | $this->driver = $driver; |
54 | 52 |
@@ -30,105 +30,105 @@ |
||
30 | 30 | */ |
31 | 31 | class Driver implements ExtendedCacheItemPoolInterface |
32 | 32 | { |
33 | - use DriverBaseTrait; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var array |
|
37 | - */ |
|
38 | - protected $staticStack = []; |
|
39 | - |
|
40 | - /** |
|
41 | - * @return bool |
|
42 | - */ |
|
43 | - public function driverCheck(): bool |
|
44 | - { |
|
45 | - return true; |
|
46 | - } |
|
47 | - |
|
48 | - /** |
|
49 | - * @return DriverStatistic |
|
50 | - */ |
|
51 | - public function getStats(): DriverStatistic |
|
52 | - { |
|
53 | - $stat = new DriverStatistic(); |
|
54 | - $stat->setInfo('[Memstatic] A memory static driver') |
|
55 | - ->setSize(mb_strlen(serialize($this->staticStack))) |
|
56 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
57 | - ->setRawData($this->staticStack); |
|
58 | - |
|
59 | - return $stat; |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * @return bool |
|
64 | - */ |
|
65 | - protected function driverConnect(): bool |
|
66 | - { |
|
67 | - return true; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @param CacheItemInterface $item |
|
72 | - * @return null|array |
|
73 | - */ |
|
74 | - protected function driverRead(CacheItemInterface $item) |
|
75 | - { |
|
76 | - return $this->staticStack[$item->getKey()] ?? null; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @param CacheItemInterface $item |
|
81 | - * @return bool |
|
82 | - * @throws PhpfastcacheInvalidArgumentException |
|
83 | - */ |
|
84 | - protected function driverWrite(CacheItemInterface $item): bool |
|
85 | - { |
|
86 | - /** |
|
87 | - * Check for Cross-Driver type confusion |
|
88 | - */ |
|
89 | - if ($item instanceof Item) { |
|
90 | - $this->staticStack[$item->getKey()] = $this->driverPreWrap($item); |
|
91 | - return true; |
|
92 | - } |
|
93 | - |
|
94 | - throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * @param CacheItemInterface $item |
|
99 | - * @return bool |
|
100 | - * @throws PhpfastcacheInvalidArgumentException |
|
101 | - */ |
|
102 | - protected function driverDelete(CacheItemInterface $item): bool |
|
103 | - { |
|
104 | - /** |
|
105 | - * Check for Cross-Driver type confusion |
|
106 | - */ |
|
107 | - if ($item instanceof Item) { |
|
108 | - $key = $item->getKey(); |
|
109 | - if (isset($this->staticStack[$key])) { |
|
110 | - unset($this->staticStack[$key]); |
|
111 | - return true; |
|
112 | - } |
|
113 | - return false; |
|
114 | - } |
|
115 | - |
|
116 | - throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
|
117 | - } |
|
118 | - |
|
119 | - /******************** |
|
33 | + use DriverBaseTrait; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var array |
|
37 | + */ |
|
38 | + protected $staticStack = []; |
|
39 | + |
|
40 | + /** |
|
41 | + * @return bool |
|
42 | + */ |
|
43 | + public function driverCheck(): bool |
|
44 | + { |
|
45 | + return true; |
|
46 | + } |
|
47 | + |
|
48 | + /** |
|
49 | + * @return DriverStatistic |
|
50 | + */ |
|
51 | + public function getStats(): DriverStatistic |
|
52 | + { |
|
53 | + $stat = new DriverStatistic(); |
|
54 | + $stat->setInfo('[Memstatic] A memory static driver') |
|
55 | + ->setSize(mb_strlen(serialize($this->staticStack))) |
|
56 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
57 | + ->setRawData($this->staticStack); |
|
58 | + |
|
59 | + return $stat; |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * @return bool |
|
64 | + */ |
|
65 | + protected function driverConnect(): bool |
|
66 | + { |
|
67 | + return true; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @param CacheItemInterface $item |
|
72 | + * @return null|array |
|
73 | + */ |
|
74 | + protected function driverRead(CacheItemInterface $item) |
|
75 | + { |
|
76 | + return $this->staticStack[$item->getKey()] ?? null; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @param CacheItemInterface $item |
|
81 | + * @return bool |
|
82 | + * @throws PhpfastcacheInvalidArgumentException |
|
83 | + */ |
|
84 | + protected function driverWrite(CacheItemInterface $item): bool |
|
85 | + { |
|
86 | + /** |
|
87 | + * Check for Cross-Driver type confusion |
|
88 | + */ |
|
89 | + if ($item instanceof Item) { |
|
90 | + $this->staticStack[$item->getKey()] = $this->driverPreWrap($item); |
|
91 | + return true; |
|
92 | + } |
|
93 | + |
|
94 | + throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * @param CacheItemInterface $item |
|
99 | + * @return bool |
|
100 | + * @throws PhpfastcacheInvalidArgumentException |
|
101 | + */ |
|
102 | + protected function driverDelete(CacheItemInterface $item): bool |
|
103 | + { |
|
104 | + /** |
|
105 | + * Check for Cross-Driver type confusion |
|
106 | + */ |
|
107 | + if ($item instanceof Item) { |
|
108 | + $key = $item->getKey(); |
|
109 | + if (isset($this->staticStack[$key])) { |
|
110 | + unset($this->staticStack[$key]); |
|
111 | + return true; |
|
112 | + } |
|
113 | + return false; |
|
114 | + } |
|
115 | + |
|
116 | + throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
|
117 | + } |
|
118 | + |
|
119 | + /******************** |
|
120 | 120 | * |
121 | 121 | * PSR-6 Extended Methods |
122 | 122 | * |
123 | 123 | *******************/ |
124 | 124 | |
125 | - /** |
|
126 | - * @return bool |
|
127 | - */ |
|
128 | - protected function driverClear(): bool |
|
129 | - { |
|
130 | - unset($this->staticStack); |
|
131 | - $this->staticStack = []; |
|
132 | - return true; |
|
133 | - } |
|
125 | + /** |
|
126 | + * @return bool |
|
127 | + */ |
|
128 | + protected function driverClear(): bool |
|
129 | + { |
|
130 | + unset($this->staticStack); |
|
131 | + $this->staticStack = []; |
|
132 | + return true; |
|
133 | + } |
|
134 | 134 | } |
@@ -71,8 +71,7 @@ |
||
71 | 71 | * @param CacheItemInterface $item |
72 | 72 | * @return null|array |
73 | 73 | */ |
74 | - protected function driverRead(CacheItemInterface $item) |
|
75 | - { |
|
74 | + protected function driverRead(CacheItemInterface $item) { |
|
76 | 75 | return $this->staticStack[$item->getKey()] ?? null; |
77 | 76 | } |
78 | 77 |
@@ -27,34 +27,34 @@ |
||
27 | 27 | */ |
28 | 28 | class Item implements ExtendedCacheItemInterface |
29 | 29 | { |
30 | - use ItemBaseTrait { |
|
31 | - ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Item constructor. |
|
36 | - * @param Driver $driver |
|
37 | - * @param $key |
|
38 | - * @throws PhpfastcacheInvalidArgumentException |
|
39 | - */ |
|
40 | - public function __construct(CouchbaseDriver $driver, $key) |
|
41 | - { |
|
42 | - $this->__BaseConstruct($driver, $key); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @param ExtendedCacheItemPoolInterface $driver |
|
47 | - * @return static |
|
48 | - * @throws PhpfastcacheInvalidArgumentException |
|
49 | - */ |
|
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
52 | - if ($driver instanceof CouchbaseDriver) { |
|
53 | - $this->driver = $driver; |
|
54 | - |
|
55 | - return $this; |
|
56 | - } |
|
57 | - |
|
58 | - throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | - } |
|
30 | + use ItemBaseTrait { |
|
31 | + ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Item constructor. |
|
36 | + * @param Driver $driver |
|
37 | + * @param $key |
|
38 | + * @throws PhpfastcacheInvalidArgumentException |
|
39 | + */ |
|
40 | + public function __construct(CouchbaseDriver $driver, $key) |
|
41 | + { |
|
42 | + $this->__BaseConstruct($driver, $key); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @param ExtendedCacheItemPoolInterface $driver |
|
47 | + * @return static |
|
48 | + * @throws PhpfastcacheInvalidArgumentException |
|
49 | + */ |
|
50 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | + { |
|
52 | + if ($driver instanceof CouchbaseDriver) { |
|
53 | + $this->driver = $driver; |
|
54 | + |
|
55 | + return $this; |
|
56 | + } |
|
57 | + |
|
58 | + throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @param $key |
38 | 38 | * @throws PhpfastcacheInvalidArgumentException |
39 | 39 | */ |
40 | - public function __construct(CouchbaseDriver $driver, $key) |
|
41 | - { |
|
40 | + public function __construct(CouchbaseDriver $driver, $key) { |
|
42 | 41 | $this->__BaseConstruct($driver, $key); |
43 | 42 | } |
44 | 43 | |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * @return static |
48 | 47 | * @throws PhpfastcacheInvalidArgumentException |
49 | 48 | */ |
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
49 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) { |
|
52 | 50 | if ($driver instanceof CouchbaseDriver) { |
53 | 51 | $this->driver = $driver; |
54 | 52 |
@@ -20,26 +20,26 @@ |
||
20 | 20 | |
21 | 21 | class Config extends ConfigurationOption |
22 | 22 | { |
23 | - /** |
|
24 | - * @var bool |
|
25 | - */ |
|
26 | - protected $htaccess = true; |
|
23 | + /** |
|
24 | + * @var bool |
|
25 | + */ |
|
26 | + protected $htaccess = true; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @return bool |
|
30 | - */ |
|
31 | - public function getHtaccess(): bool |
|
32 | - { |
|
33 | - return $this->htaccess; |
|
34 | - } |
|
28 | + /** |
|
29 | + * @return bool |
|
30 | + */ |
|
31 | + public function getHtaccess(): bool |
|
32 | + { |
|
33 | + return $this->htaccess; |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param bool $htaccess |
|
38 | - * @return self |
|
39 | - */ |
|
40 | - public function setHtaccess(bool $htaccess): self |
|
41 | - { |
|
42 | - $this->htaccess = $htaccess; |
|
43 | - return $this; |
|
44 | - } |
|
36 | + /** |
|
37 | + * @param bool $htaccess |
|
38 | + * @return self |
|
39 | + */ |
|
40 | + public function setHtaccess(bool $htaccess): self |
|
41 | + { |
|
42 | + $this->htaccess = $htaccess; |
|
43 | + return $this; |
|
44 | + } |
|
45 | 45 | } |
@@ -27,34 +27,34 @@ |
||
27 | 27 | */ |
28 | 28 | class Item implements ExtendedCacheItemInterface |
29 | 29 | { |
30 | - use ItemBaseTrait { |
|
31 | - ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Item constructor. |
|
36 | - * @param Driver $driver |
|
37 | - * @param $key |
|
38 | - * @throws PhpfastcacheInvalidArgumentException |
|
39 | - */ |
|
40 | - public function __construct(LeveldbDriver $driver, $key) |
|
41 | - { |
|
42 | - $this->__BaseConstruct($driver, $key); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @param ExtendedCacheItemPoolInterface $driver |
|
47 | - * @return static |
|
48 | - * @throws PhpfastcacheInvalidArgumentException |
|
49 | - */ |
|
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
52 | - if ($driver instanceof LeveldbDriver) { |
|
53 | - $this->driver = $driver; |
|
54 | - |
|
55 | - return $this; |
|
56 | - } |
|
57 | - |
|
58 | - throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | - } |
|
30 | + use ItemBaseTrait { |
|
31 | + ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Item constructor. |
|
36 | + * @param Driver $driver |
|
37 | + * @param $key |
|
38 | + * @throws PhpfastcacheInvalidArgumentException |
|
39 | + */ |
|
40 | + public function __construct(LeveldbDriver $driver, $key) |
|
41 | + { |
|
42 | + $this->__BaseConstruct($driver, $key); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @param ExtendedCacheItemPoolInterface $driver |
|
47 | + * @return static |
|
48 | + * @throws PhpfastcacheInvalidArgumentException |
|
49 | + */ |
|
50 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | + { |
|
52 | + if ($driver instanceof LeveldbDriver) { |
|
53 | + $this->driver = $driver; |
|
54 | + |
|
55 | + return $this; |
|
56 | + } |
|
57 | + |
|
58 | + throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @param $key |
38 | 38 | * @throws PhpfastcacheInvalidArgumentException |
39 | 39 | */ |
40 | - public function __construct(LeveldbDriver $driver, $key) |
|
41 | - { |
|
40 | + public function __construct(LeveldbDriver $driver, $key) { |
|
42 | 41 | $this->__BaseConstruct($driver, $key); |
43 | 42 | } |
44 | 43 | |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * @return static |
48 | 47 | * @throws PhpfastcacheInvalidArgumentException |
49 | 48 | */ |
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
49 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) { |
|
52 | 50 | if ($driver instanceof LeveldbDriver) { |
53 | 51 | $this->driver = $driver; |
54 | 52 |
@@ -27,34 +27,34 @@ |
||
27 | 27 | */ |
28 | 28 | class Item implements ExtendedCacheItemInterface |
29 | 29 | { |
30 | - use ItemBaseTrait { |
|
31 | - ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Item constructor. |
|
36 | - * @param Driver $driver |
|
37 | - * @param $key |
|
38 | - * @throws PhpfastcacheInvalidArgumentException |
|
39 | - */ |
|
40 | - public function __construct(MemcachedDriver $driver, $key) |
|
41 | - { |
|
42 | - $this->__BaseConstruct($driver, $key); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @param ExtendedCacheItemPoolInterface $driver |
|
47 | - * @return static |
|
48 | - * @throws PhpfastcacheInvalidArgumentException |
|
49 | - */ |
|
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
52 | - if ($driver instanceof MemcachedDriver) { |
|
53 | - $this->driver = $driver; |
|
54 | - |
|
55 | - return $this; |
|
56 | - } |
|
57 | - |
|
58 | - throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | - } |
|
30 | + use ItemBaseTrait { |
|
31 | + ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Item constructor. |
|
36 | + * @param Driver $driver |
|
37 | + * @param $key |
|
38 | + * @throws PhpfastcacheInvalidArgumentException |
|
39 | + */ |
|
40 | + public function __construct(MemcachedDriver $driver, $key) |
|
41 | + { |
|
42 | + $this->__BaseConstruct($driver, $key); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @param ExtendedCacheItemPoolInterface $driver |
|
47 | + * @return static |
|
48 | + * @throws PhpfastcacheInvalidArgumentException |
|
49 | + */ |
|
50 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | + { |
|
52 | + if ($driver instanceof MemcachedDriver) { |
|
53 | + $this->driver = $driver; |
|
54 | + |
|
55 | + return $this; |
|
56 | + } |
|
57 | + |
|
58 | + throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @param $key |
38 | 38 | * @throws PhpfastcacheInvalidArgumentException |
39 | 39 | */ |
40 | - public function __construct(MemcachedDriver $driver, $key) |
|
41 | - { |
|
40 | + public function __construct(MemcachedDriver $driver, $key) { |
|
42 | 41 | $this->__BaseConstruct($driver, $key); |
43 | 42 | } |
44 | 43 | |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * @return static |
48 | 47 | * @throws PhpfastcacheInvalidArgumentException |
49 | 48 | */ |
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
49 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) { |
|
52 | 50 | if ($driver instanceof MemcachedDriver) { |
53 | 51 | $this->driver = $driver; |
54 | 52 |
@@ -21,168 +21,168 @@ |
||
21 | 21 | |
22 | 22 | class Config extends ConfigurationOption |
23 | 23 | { |
24 | - /** |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - protected $host = '127.0.0.1'; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var int |
|
31 | - */ |
|
32 | - protected $port = 6379; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var null|string |
|
36 | - */ |
|
37 | - protected $password = ''; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var null|int |
|
41 | - */ |
|
42 | - protected $database = 0; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var int |
|
46 | - */ |
|
47 | - protected $timeout = 5; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var RedisClient |
|
51 | - */ |
|
52 | - protected $redisClient; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var string |
|
56 | - */ |
|
57 | - protected $optPrefix = ''; |
|
58 | - |
|
59 | - /** |
|
60 | - * @return string |
|
61 | - */ |
|
62 | - public function getHost(): string |
|
63 | - { |
|
64 | - return $this->host; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * @param string $host |
|
69 | - * @return self |
|
70 | - */ |
|
71 | - public function setHost(string $host): self |
|
72 | - { |
|
73 | - $this->host = $host; |
|
74 | - return $this; |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * @return int |
|
79 | - */ |
|
80 | - public function getPort(): int |
|
81 | - { |
|
82 | - return $this->port; |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * @param int $port |
|
87 | - * @return self |
|
88 | - */ |
|
89 | - public function setPort(int $port): self |
|
90 | - { |
|
91 | - $this->port = $port; |
|
92 | - return $this; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * @return null|string |
|
97 | - */ |
|
98 | - public function getPassword() |
|
99 | - { |
|
100 | - return $this->password; |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * @param string|null $password |
|
105 | - * |
|
106 | - * @return self |
|
107 | - */ |
|
108 | - public function setPassword(string $password = null): self |
|
109 | - { |
|
110 | - $this->password = $password; |
|
111 | - return $this; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * @return null|int |
|
116 | - */ |
|
117 | - public function getDatabase(): ?int |
|
118 | - { |
|
119 | - return $this->database; |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * @param int|null $database |
|
124 | - * |
|
125 | - * @return self |
|
126 | - */ |
|
127 | - public function setDatabase(int $database = null): self |
|
128 | - { |
|
129 | - $this->database = $database; |
|
130 | - return $this; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * @return int |
|
135 | - */ |
|
136 | - public function getTimeout(): int |
|
137 | - { |
|
138 | - return $this->timeout; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * @param int $timeout |
|
143 | - * @return self |
|
144 | - */ |
|
145 | - public function setTimeout(int $timeout): self |
|
146 | - { |
|
147 | - $this->timeout = $timeout; |
|
148 | - return $this; |
|
149 | - } |
|
150 | - |
|
151 | - /** |
|
152 | - * @return RedisClient|null |
|
153 | - */ |
|
154 | - public function getRedisClient() |
|
155 | - { |
|
156 | - return $this->redisClient; |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * @param RedisClient $predisClient |null |
|
161 | - * @return Config |
|
162 | - */ |
|
163 | - public function setRedisClient(RedisClient $redisClient = null): Config |
|
164 | - { |
|
165 | - $this->redisClient = $redisClient; |
|
166 | - return $this; |
|
167 | - } |
|
168 | - |
|
169 | - /** |
|
170 | - * @return string |
|
171 | - * @since 7.0.2 |
|
172 | - */ |
|
173 | - public function getOptPrefix(): string |
|
174 | - { |
|
175 | - return $this->optPrefix; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @param string $optPrefix |
|
180 | - * @return Config |
|
181 | - * @since 7.0.2 |
|
182 | - */ |
|
183 | - public function setOptPrefix(string $optPrefix): Config |
|
184 | - { |
|
185 | - $this->optPrefix = trim($optPrefix); |
|
186 | - return $this; |
|
187 | - } |
|
24 | + /** |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + protected $host = '127.0.0.1'; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var int |
|
31 | + */ |
|
32 | + protected $port = 6379; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var null|string |
|
36 | + */ |
|
37 | + protected $password = ''; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var null|int |
|
41 | + */ |
|
42 | + protected $database = 0; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var int |
|
46 | + */ |
|
47 | + protected $timeout = 5; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var RedisClient |
|
51 | + */ |
|
52 | + protected $redisClient; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var string |
|
56 | + */ |
|
57 | + protected $optPrefix = ''; |
|
58 | + |
|
59 | + /** |
|
60 | + * @return string |
|
61 | + */ |
|
62 | + public function getHost(): string |
|
63 | + { |
|
64 | + return $this->host; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * @param string $host |
|
69 | + * @return self |
|
70 | + */ |
|
71 | + public function setHost(string $host): self |
|
72 | + { |
|
73 | + $this->host = $host; |
|
74 | + return $this; |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * @return int |
|
79 | + */ |
|
80 | + public function getPort(): int |
|
81 | + { |
|
82 | + return $this->port; |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * @param int $port |
|
87 | + * @return self |
|
88 | + */ |
|
89 | + public function setPort(int $port): self |
|
90 | + { |
|
91 | + $this->port = $port; |
|
92 | + return $this; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * @return null|string |
|
97 | + */ |
|
98 | + public function getPassword() |
|
99 | + { |
|
100 | + return $this->password; |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * @param string|null $password |
|
105 | + * |
|
106 | + * @return self |
|
107 | + */ |
|
108 | + public function setPassword(string $password = null): self |
|
109 | + { |
|
110 | + $this->password = $password; |
|
111 | + return $this; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * @return null|int |
|
116 | + */ |
|
117 | + public function getDatabase(): ?int |
|
118 | + { |
|
119 | + return $this->database; |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * @param int|null $database |
|
124 | + * |
|
125 | + * @return self |
|
126 | + */ |
|
127 | + public function setDatabase(int $database = null): self |
|
128 | + { |
|
129 | + $this->database = $database; |
|
130 | + return $this; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * @return int |
|
135 | + */ |
|
136 | + public function getTimeout(): int |
|
137 | + { |
|
138 | + return $this->timeout; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * @param int $timeout |
|
143 | + * @return self |
|
144 | + */ |
|
145 | + public function setTimeout(int $timeout): self |
|
146 | + { |
|
147 | + $this->timeout = $timeout; |
|
148 | + return $this; |
|
149 | + } |
|
150 | + |
|
151 | + /** |
|
152 | + * @return RedisClient|null |
|
153 | + */ |
|
154 | + public function getRedisClient() |
|
155 | + { |
|
156 | + return $this->redisClient; |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * @param RedisClient $predisClient |null |
|
161 | + * @return Config |
|
162 | + */ |
|
163 | + public function setRedisClient(RedisClient $redisClient = null): Config |
|
164 | + { |
|
165 | + $this->redisClient = $redisClient; |
|
166 | + return $this; |
|
167 | + } |
|
168 | + |
|
169 | + /** |
|
170 | + * @return string |
|
171 | + * @since 7.0.2 |
|
172 | + */ |
|
173 | + public function getOptPrefix(): string |
|
174 | + { |
|
175 | + return $this->optPrefix; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @param string $optPrefix |
|
180 | + * @return Config |
|
181 | + * @since 7.0.2 |
|
182 | + */ |
|
183 | + public function setOptPrefix(string $optPrefix): Config |
|
184 | + { |
|
185 | + $this->optPrefix = trim($optPrefix); |
|
186 | + return $this; |
|
187 | + } |
|
188 | 188 | } |
189 | 189 | \ No newline at end of file |
@@ -95,8 +95,7 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * @return null|string |
97 | 97 | */ |
98 | - public function getPassword() |
|
99 | - { |
|
98 | + public function getPassword() { |
|
100 | 99 | return $this->password; |
101 | 100 | } |
102 | 101 | |
@@ -151,8 +150,7 @@ discard block |
||
151 | 150 | /** |
152 | 151 | * @return RedisClient|null |
153 | 152 | */ |
154 | - public function getRedisClient() |
|
155 | - { |
|
153 | + public function getRedisClient() { |
|
156 | 154 | return $this->redisClient; |
157 | 155 | } |
158 | 156 |
@@ -27,34 +27,34 @@ |
||
27 | 27 | */ |
28 | 28 | class Item implements ExtendedCacheItemInterface |
29 | 29 | { |
30 | - use ItemBaseTrait { |
|
31 | - ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Item constructor. |
|
36 | - * @param Driver $driver |
|
37 | - * @param $key |
|
38 | - * @throws PhpfastcacheInvalidArgumentException |
|
39 | - */ |
|
40 | - public function __construct(RedisDriver $driver, $key) |
|
41 | - { |
|
42 | - $this->__BaseConstruct($driver, $key); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @param ExtendedCacheItemPoolInterface $driver |
|
47 | - * @return static |
|
48 | - * @throws PhpfastcacheInvalidArgumentException |
|
49 | - */ |
|
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
52 | - if ($driver instanceof RedisDriver) { |
|
53 | - $this->driver = $driver; |
|
54 | - |
|
55 | - return $this; |
|
56 | - } |
|
57 | - |
|
58 | - throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | - } |
|
30 | + use ItemBaseTrait { |
|
31 | + ItemBaseTrait::__construct as __BaseConstruct; |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Item constructor. |
|
36 | + * @param Driver $driver |
|
37 | + * @param $key |
|
38 | + * @throws PhpfastcacheInvalidArgumentException |
|
39 | + */ |
|
40 | + public function __construct(RedisDriver $driver, $key) |
|
41 | + { |
|
42 | + $this->__BaseConstruct($driver, $key); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @param ExtendedCacheItemPoolInterface $driver |
|
47 | + * @return static |
|
48 | + * @throws PhpfastcacheInvalidArgumentException |
|
49 | + */ |
|
50 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | + { |
|
52 | + if ($driver instanceof RedisDriver) { |
|
53 | + $this->driver = $driver; |
|
54 | + |
|
55 | + return $this; |
|
56 | + } |
|
57 | + |
|
58 | + throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @param $key |
38 | 38 | * @throws PhpfastcacheInvalidArgumentException |
39 | 39 | */ |
40 | - public function __construct(RedisDriver $driver, $key) |
|
41 | - { |
|
40 | + public function __construct(RedisDriver $driver, $key) { |
|
42 | 41 | $this->__BaseConstruct($driver, $key); |
43 | 42 | } |
44 | 43 | |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * @return static |
48 | 47 | * @throws PhpfastcacheInvalidArgumentException |
49 | 48 | */ |
50 | - public function setDriver(ExtendedCacheItemPoolInterface $driver) |
|
51 | - { |
|
49 | + public function setDriver(ExtendedCacheItemPoolInterface $driver) { |
|
52 | 50 | if ($driver instanceof RedisDriver) { |
53 | 51 | $this->driver = $driver; |
54 | 52 |
@@ -23,230 +23,230 @@ |
||
23 | 23 | |
24 | 24 | class Config extends ConfigurationOption |
25 | 25 | { |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - protected $host = '127.0.0.1'; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - protected $port = 6379; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - protected $password = ''; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var int |
|
43 | - */ |
|
44 | - protected $database = 0; |
|
45 | - |
|
46 | - /** |
|
47 | - * @var Client |
|
48 | - */ |
|
49 | - protected $predisClient; |
|
50 | - |
|
51 | - /** |
|
52 | - * @var string |
|
53 | - */ |
|
54 | - protected $optPrefix = ''; |
|
55 | - |
|
56 | - /** |
|
57 | - * @var int |
|
58 | - */ |
|
59 | - protected $timeout = 5; |
|
60 | - |
|
61 | - /** |
|
62 | - * @var bool |
|
63 | - */ |
|
64 | - protected $persistent = false; |
|
65 | - |
|
66 | - /** |
|
67 | - * @var string |
|
68 | - */ |
|
69 | - protected $scheme = 'unix'; |
|
70 | - |
|
71 | - /** |
|
72 | - * @return array |
|
73 | - */ |
|
74 | - public function getPredisConfigArray(): array |
|
75 | - { |
|
76 | - return [ |
|
77 | - 'host' => $this->getHost(), |
|
78 | - 'port' => $this->getPort(), |
|
79 | - 'password' => $this->getPassword() ?: null, |
|
80 | - 'database' => $this->getDatabase(), |
|
81 | - 'timeout' => $this->getTimeout(), |
|
82 | - ]; |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * @return string |
|
87 | - */ |
|
88 | - public function getHost(): string |
|
89 | - { |
|
90 | - return $this->host; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * @param string $host |
|
95 | - * @return Config |
|
96 | - */ |
|
97 | - public function setHost(string $host): self |
|
98 | - { |
|
99 | - $this->host = $host; |
|
100 | - return $this; |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * @return int |
|
105 | - */ |
|
106 | - public function getPort(): int |
|
107 | - { |
|
108 | - return $this->port; |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * @param int $port |
|
113 | - * @return Config |
|
114 | - */ |
|
115 | - public function setPort(int $port): self |
|
116 | - { |
|
117 | - $this->port = $port; |
|
118 | - return $this; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * @return null |
|
123 | - */ |
|
124 | - public function getPassword() |
|
125 | - { |
|
126 | - return $this->password; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @param null $password |
|
131 | - * @return self |
|
132 | - */ |
|
133 | - public function setPassword(string $password): self |
|
134 | - { |
|
135 | - $this->password = $password; |
|
136 | - return $this; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @return int |
|
141 | - */ |
|
142 | - public function getDatabase(): int |
|
143 | - { |
|
144 | - return $this->database; |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * @param int $database |
|
149 | - * @return Config |
|
150 | - */ |
|
151 | - public function setDatabase(int $database): self |
|
152 | - { |
|
153 | - $this->database = $database; |
|
154 | - return $this; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * @return int |
|
159 | - */ |
|
160 | - public function getTimeout(): int |
|
161 | - { |
|
162 | - return $this->timeout; |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * @param int $timeout |
|
167 | - * @return self |
|
168 | - */ |
|
169 | - public function setTimeout(int $timeout): self |
|
170 | - { |
|
171 | - $this->timeout = $timeout; |
|
172 | - return $this; |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * @return Client|null |
|
177 | - */ |
|
178 | - public function getPredisClient() |
|
179 | - { |
|
180 | - return $this->predisClient; |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * @param Client $predisClient |null |
|
185 | - * @return Config |
|
186 | - */ |
|
187 | - public function setPredisClient(Client $predisClient = null): Config |
|
188 | - { |
|
189 | - $this->predisClient = $predisClient; |
|
190 | - return $this; |
|
191 | - } |
|
192 | - |
|
193 | - /** |
|
194 | - * @return string |
|
195 | - * @since 7.0.2 |
|
196 | - */ |
|
197 | - public function getOptPrefix(): string |
|
198 | - { |
|
199 | - return $this->optPrefix; |
|
200 | - } |
|
201 | - |
|
202 | - /** |
|
203 | - * @param string $optPrefix |
|
204 | - * @return Config |
|
205 | - * @since 7.0.2 |
|
206 | - */ |
|
207 | - public function setOptPrefix(string $optPrefix): Config |
|
208 | - { |
|
209 | - $this->optPrefix = trim($optPrefix); |
|
210 | - return $this; |
|
211 | - } |
|
212 | - |
|
213 | - /** |
|
214 | - * @return bool |
|
215 | - */ |
|
216 | - public function isPersistent(): bool |
|
217 | - { |
|
218 | - return $this->persistent; |
|
219 | - } |
|
220 | - |
|
221 | - /** |
|
222 | - * @param bool $persistent |
|
223 | - * @return Config |
|
224 | - */ |
|
225 | - public function setPersistent(bool $persistent): Config |
|
226 | - { |
|
227 | - $this->persistent = $persistent; |
|
228 | - return $this; |
|
229 | - } |
|
230 | - |
|
231 | - /** |
|
232 | - * @return string |
|
233 | - */ |
|
234 | - public function getScheme(): string |
|
235 | - { |
|
236 | - return $this->scheme; |
|
237 | - } |
|
238 | - |
|
239 | - /** |
|
240 | - * @param string $scheme |
|
241 | - * @return Config |
|
242 | - * @throws PhpfastcacheInvalidConfigurationException |
|
243 | - */ |
|
244 | - public function setScheme(string $scheme): Config |
|
245 | - { |
|
246 | - if (!in_array($scheme, ['unix', 'tls'], true)) { |
|
247 | - throw new PhpfastcacheInvalidConfigurationException('Invalid scheme: ' . $scheme); |
|
248 | - } |
|
249 | - $this->scheme = $scheme; |
|
250 | - return $this; |
|
251 | - } |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + protected $host = '127.0.0.1'; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + protected $port = 6379; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + protected $password = ''; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var int |
|
43 | + */ |
|
44 | + protected $database = 0; |
|
45 | + |
|
46 | + /** |
|
47 | + * @var Client |
|
48 | + */ |
|
49 | + protected $predisClient; |
|
50 | + |
|
51 | + /** |
|
52 | + * @var string |
|
53 | + */ |
|
54 | + protected $optPrefix = ''; |
|
55 | + |
|
56 | + /** |
|
57 | + * @var int |
|
58 | + */ |
|
59 | + protected $timeout = 5; |
|
60 | + |
|
61 | + /** |
|
62 | + * @var bool |
|
63 | + */ |
|
64 | + protected $persistent = false; |
|
65 | + |
|
66 | + /** |
|
67 | + * @var string |
|
68 | + */ |
|
69 | + protected $scheme = 'unix'; |
|
70 | + |
|
71 | + /** |
|
72 | + * @return array |
|
73 | + */ |
|
74 | + public function getPredisConfigArray(): array |
|
75 | + { |
|
76 | + return [ |
|
77 | + 'host' => $this->getHost(), |
|
78 | + 'port' => $this->getPort(), |
|
79 | + 'password' => $this->getPassword() ?: null, |
|
80 | + 'database' => $this->getDatabase(), |
|
81 | + 'timeout' => $this->getTimeout(), |
|
82 | + ]; |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * @return string |
|
87 | + */ |
|
88 | + public function getHost(): string |
|
89 | + { |
|
90 | + return $this->host; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * @param string $host |
|
95 | + * @return Config |
|
96 | + */ |
|
97 | + public function setHost(string $host): self |
|
98 | + { |
|
99 | + $this->host = $host; |
|
100 | + return $this; |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * @return int |
|
105 | + */ |
|
106 | + public function getPort(): int |
|
107 | + { |
|
108 | + return $this->port; |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * @param int $port |
|
113 | + * @return Config |
|
114 | + */ |
|
115 | + public function setPort(int $port): self |
|
116 | + { |
|
117 | + $this->port = $port; |
|
118 | + return $this; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * @return null |
|
123 | + */ |
|
124 | + public function getPassword() |
|
125 | + { |
|
126 | + return $this->password; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @param null $password |
|
131 | + * @return self |
|
132 | + */ |
|
133 | + public function setPassword(string $password): self |
|
134 | + { |
|
135 | + $this->password = $password; |
|
136 | + return $this; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @return int |
|
141 | + */ |
|
142 | + public function getDatabase(): int |
|
143 | + { |
|
144 | + return $this->database; |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * @param int $database |
|
149 | + * @return Config |
|
150 | + */ |
|
151 | + public function setDatabase(int $database): self |
|
152 | + { |
|
153 | + $this->database = $database; |
|
154 | + return $this; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * @return int |
|
159 | + */ |
|
160 | + public function getTimeout(): int |
|
161 | + { |
|
162 | + return $this->timeout; |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * @param int $timeout |
|
167 | + * @return self |
|
168 | + */ |
|
169 | + public function setTimeout(int $timeout): self |
|
170 | + { |
|
171 | + $this->timeout = $timeout; |
|
172 | + return $this; |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * @return Client|null |
|
177 | + */ |
|
178 | + public function getPredisClient() |
|
179 | + { |
|
180 | + return $this->predisClient; |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * @param Client $predisClient |null |
|
185 | + * @return Config |
|
186 | + */ |
|
187 | + public function setPredisClient(Client $predisClient = null): Config |
|
188 | + { |
|
189 | + $this->predisClient = $predisClient; |
|
190 | + return $this; |
|
191 | + } |
|
192 | + |
|
193 | + /** |
|
194 | + * @return string |
|
195 | + * @since 7.0.2 |
|
196 | + */ |
|
197 | + public function getOptPrefix(): string |
|
198 | + { |
|
199 | + return $this->optPrefix; |
|
200 | + } |
|
201 | + |
|
202 | + /** |
|
203 | + * @param string $optPrefix |
|
204 | + * @return Config |
|
205 | + * @since 7.0.2 |
|
206 | + */ |
|
207 | + public function setOptPrefix(string $optPrefix): Config |
|
208 | + { |
|
209 | + $this->optPrefix = trim($optPrefix); |
|
210 | + return $this; |
|
211 | + } |
|
212 | + |
|
213 | + /** |
|
214 | + * @return bool |
|
215 | + */ |
|
216 | + public function isPersistent(): bool |
|
217 | + { |
|
218 | + return $this->persistent; |
|
219 | + } |
|
220 | + |
|
221 | + /** |
|
222 | + * @param bool $persistent |
|
223 | + * @return Config |
|
224 | + */ |
|
225 | + public function setPersistent(bool $persistent): Config |
|
226 | + { |
|
227 | + $this->persistent = $persistent; |
|
228 | + return $this; |
|
229 | + } |
|
230 | + |
|
231 | + /** |
|
232 | + * @return string |
|
233 | + */ |
|
234 | + public function getScheme(): string |
|
235 | + { |
|
236 | + return $this->scheme; |
|
237 | + } |
|
238 | + |
|
239 | + /** |
|
240 | + * @param string $scheme |
|
241 | + * @return Config |
|
242 | + * @throws PhpfastcacheInvalidConfigurationException |
|
243 | + */ |
|
244 | + public function setScheme(string $scheme): Config |
|
245 | + { |
|
246 | + if (!in_array($scheme, ['unix', 'tls'], true)) { |
|
247 | + throw new PhpfastcacheInvalidConfigurationException('Invalid scheme: ' . $scheme); |
|
248 | + } |
|
249 | + $this->scheme = $scheme; |
|
250 | + return $this; |
|
251 | + } |
|
252 | 252 | } |
253 | 253 | \ No newline at end of file |
@@ -121,8 +121,7 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * @return null |
123 | 123 | */ |
124 | - public function getPassword() |
|
125 | - { |
|
124 | + public function getPassword() { |
|
126 | 125 | return $this->password; |
127 | 126 | } |
128 | 127 | |
@@ -175,8 +174,7 @@ discard block |
||
175 | 174 | /** |
176 | 175 | * @return Client|null |
177 | 176 | */ |
178 | - public function getPredisClient() |
|
179 | - { |
|
177 | + public function getPredisClient() { |
|
180 | 178 | return $this->predisClient; |
181 | 179 | } |
182 | 180 |