File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
lib/Phpfastcache/Drivers/Memcached Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ class Config extends ConfigurationOption
5757 */
5858 protected $ saslPassword = '' ;
5959
60+ /**
61+ * @var string
62+ */
63+ protected $ optPrefix = '' ;
64+
6065 /**
6166 * @return string
6267 */
@@ -161,4 +166,24 @@ public function setPort(int $port): self
161166 $ this ->port = $ port ;
162167 return $ this ;
163168 }
169+
170+ /**
171+ * @return string
172+ * @since 8.0.2
173+ */
174+ public function getOptPrefix (): string
175+ {
176+ return $ this ->optPrefix ;
177+ }
178+
179+ /**
180+ * @param string $optPrefix
181+ * @return Config
182+ * @since 8.0.2
183+ */
184+ public function setOptPrefix (string $ optPrefix ): Config
185+ {
186+ $ this ->optPrefix = trim ($ optPrefix );
187+ return $ this ;
188+ }
164189}
Original file line number Diff line number Diff line change @@ -87,7 +87,13 @@ public function getStats(): DriverStatistic
8787 protected function driverConnect (): bool
8888 {
8989 $ this ->instance = new MemcachedSoftware ();
90+ $ optPrefix = $ this ->getConfig ()->getOptPrefix ();
9091 $ this ->instance ->setOption (MemcachedSoftware::OPT_BINARY_PROTOCOL , true );
92+
93+ if ($ optPrefix ) {
94+ $ this ->instance ->setOption (MemcachedSoftware::OPT_PREFIX_KEY , $ optPrefix );
95+ }
96+
9197 $ servers = $ this ->getConfig ()->getServers ();
9298
9399 if (count ($ servers ) < 1 ) {
You can’t perform that action at this time.
0 commit comments