Client Configuration Cache
The client configuration cache file contains the current cluster configuration that Couchbase Server uses at startup.
|Use of the configuration cache applies only to PHP (not to Java and .NET).|
The majority of the Couchbase clusters are running in a steady state most of the time, which means that the cluster nodes are not removed or added very often. Since clients only infrequently receive an update from the cluster whose topology is changing, cluster information is well suited for client-side caching.
When the client is instantiated, it looks for a cached named file in the file system. If the file is there, the client assumes that it belongs to a current cluster configuration and starts using it. If it isn’t there, the client starts a normal bootstrap to get the configuration from the cluster and writes it to a file.
Whenever you try to access an item on a node and the node tells you that you tried to communicate with the wrong node (NOT_MY_VBUCKET), you invalidate the cache and the SDK automatically requests a new copy of the configuration. In newer versions of Couchbase Server (v2.5 and higher) and SDKs, do not have to request the configuration, but it is automatically received from the Couchbase node as part of the NOT_MY_VBUCKET error response.
Use of the configuration cache-file is available only through PHP (not through Java or .NET).
config_cache is best done in the connection string:
<?php $connection = new \Couchbase\Cluster("couchbase://127.0.0.1?config_cache=/tmp/test.config.cache");