Skip to content

Commit 58fa396

Browse files
committed
Modified readme
1 parent c221e13 commit 58fa396

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require_once 'vendor/autoload.php';
2626
use PhpCache\CacheServer\CacheServer;
2727
use PhpCache\ServiceManager\ConfigAggregator;
2828
use PhpCache\ServiceManager\ServiceManager;
29-
// You can import multiple config files to overwrite parameters in the basic config or add extra factories
29+
// You can import multiple config files to overwrite parameters in the basic config or add extra parameters, including dependency injection
3030
$config = include_once 'config.php';
3131
$configAggregator = new ConfigAggregator();
3232
$configAggregator->addConfig($config);
@@ -42,16 +42,24 @@ php testServer.php
4242
```
4343
mv daemon.sh /etc/init.d/php-cache
4444
chmod +x /etc/init.d/php-cache
45-
# in this case you have to make the phar file globally executable because the daemon file will run it before stopping the service
46-
# create a directory called 'phar-build' -> copy the vendor and src folders to it -> copy the phpCache file to the directory -> run pharBuilder.php.
47-
mv php-cache.phar /usr/local/bin/php-cache
48-
chmod +x /usr/local/bin/php-cache
4945
# now you can use systemctl style service management
5046
sudo service php-cache start
5147
```
52-
##### Note 1: you can modify the contents of `daemon.sh` if you want to use other directories
53-
##### Note 2: A `.phar` file is a php archive file, which packs a php application into one file. If the sources or the config changes, it needs to be rebuilt!
54-
48+
##### Note: you can modify the contents of `daemon.sh` if you want to use other directories
49+
#### Configuration array:
50+
- `config`: Basic configuration array
51+
-- `memoryLimit`: as the name suggests, after we exceed the limit, our data in the cache pool gets backed up to file system
52+
-- `location`: server IP address or socket file location (string)
53+
-- `port`: the port to run the sockets on (number)
54+
-- `bufferSize`: how big chunks of data is being read from a stream (bytes)
55+
-- `ttl`: time to live; how long an entry should take space up in the cache pool before being deleted (seconds)
56+
-- `backupTime`: schedule backups (seconds)
57+
-- `backupDir`: where to store backed up data? A backup is made when we are shutting down the server service, when the scheduled backup occures or our cache pool exceeded it's memory limit
58+
-- `socketType`: which socket type should we use? Open a port on the network for the socket or create a file for the socket. Values must be either `file` (`CacheIOHandler::SOCKET_TYPE_FILE`) or `ip` (`CacheIOHandler::SOCKET_TYPE_IP`)
59+
- `services`: service manager configuration
60+
-- `aliases`: a name assigned for a real service (Example: `'cache-server' => CacheServer::class`)
61+
-- `factories`: service name with factory name for service pairs
62+
-- `invokables`: services with no dependencies
5563
#### Adding Server Event Listeners:
5664
- Create a config file that looks like this:
5765
```
@@ -116,6 +124,6 @@ echo $client->get('test');
116124
php testClient.php
117125
```
118126
#### CLI Commands:
119-
`./php-cache.phar get <key>` gets entries for the specified key. If no key is specified, it returns all entries.
120-
`./php-cache.phar set <key> <value>` pushes an entry to the cache pool with the given key - value pair.
121-
`./php-cache.phar delete <key>` deletes the entry with with the given key
127+
`./phpCache get <key>` gets entries for the specified key. If no key is specified, it returns all entries.
128+
`./phpCache set <key> <value>` pushes an entry to the cache pool with the given key - value pair.
129+
`./phpCache delete <key>` deletes the entry with the given key

0 commit comments

Comments
 (0)