Commit c0d91e2f authored by Hannes Peterseim's avatar Hannes Peterseim
Browse files

some readme format fixes

parent 79a02a54
Pipeline #2 failed with stages
......@@ -4,152 +4,227 @@ YAMS v 1.0
https://www.petit-souris.de
##introduction
YAMS is an small in memory data store, completely written in PHP.
It comes with an server component and an client libary for an simple use in your PHP Scripts without the need of installing big products like redis or memcache.
The whole project has an size of some kilobytes.
You can use it as an very fast in memory caching layer for small data of any type. Perfect for an real fast session storing.
YAMS is an small in memory data store, completely written in PHP.
It comes with an server component and an client libary for an simple use in your PHP Scripts without the need of installing big products like redis or memcache.
The whole project has an size of some kilobytes.
You can use it as an very fast in memory caching layer for small data of any type. Perfect for an real fast session storing.
##installation
Copy the server script (server.php) to an save place and run it as an service with "php server.php &".
Standard port will be 5000, but you can define an own port via "php server.php port &" the server listens only on 127.0.0.1:port.
Do not forget to check the amount of memory an script can use, this defines the maximum size of the array the the data will be hold.
Copy the client script (client.php) to the place where you need it.
You can test everything with the supplied test script via "php test.php".
For your other use include it into your scripts via "use hp/yams/client;" if there is an autoloader or use "require('pathtothescript/client.php');" instead.
Create a new instance, connect to the server, get, set values as you need.
Copy the server script (server.php) to an save place and run it as an service with "php server.php &".
Standard port will be 5000, but you can define an own port via "php server.php port &" the server listens only on 127.0.0.1:port.
Do not forget to check the amount of memory an script can use, this defines the maximum size of the array the the data will be hold.
Copy the client script (client.php) to the place where you need it.
You can test everything with the supplied test script via "php test.php".
For your other use include it into your scripts via "use hp/yams/client;" if there is an autoloader or use "require('pathtothescript/client.php');" instead.
Create a new instance, connect to the server, get, set values as you need.
##commands
command examples based on ``$yamsClient = new client();``
###connect
connects to the server
connects to the server
connect(ip, port);
####parameters :
ip : string '127.0.0.1'
port : int 5000 (should be the same port the server listens)
####return :
boolean
true if connection was successful, false if connection failed
####example
$yamsClient->connect('127.0.0.1', 5000);
###stats
delivers some server stats from the server
stats();
####return :
array
with the following keys :
array
with the following keys :
stores = number of stores
elements = number of elements overall
memory = memory usage in bytes
stores = detailed store data
####example
$yamsClient->stats();
###addstore
creates an dedicated memory store
addstore(store);
####parameters :
store : string 'choosedstore'
####return :
boolean
true if the key could be created, false if not
####example
$yamsClient->addstore('choosedstore');
###existstore
detemines wethder an dedicated memory exists
existstore(store);
####parameters :
store : string 'choosedstore'
####return :
boolean
true if the key could be deleted, false if not
####example
$yamsClient->existstore('choosedstore');
###delstore
deletes an dedicated memory store
delstore(store);
####parameters :
store : string 'choosedstore'
####return :
boolean
true if the key could be deleted, false if not
####example
$yamsClient->delstore('choosedstore');
###exist
determines wether an key exists in the given store
exist(key, store);
####parameters :
key : string 'choosedkey'
store : string 'choosedstore' (optional, if not setted, standard store will be used)
####return :
boolean
true if the key exists, false if not
####example
$yamsClient->exist('choosedkey','choosedstore');
###get
gets the value of an given key from the given store
get('choosedkey','choosedstore');
####parameters :
key : string 'abc'
store : string 'choosedstore' (optional, if not setted, standard store will be used)
####return :
string|boolean
string if the key exists, false if not
####example
$yamsClient->get('choosedkey');
###set
sets the value of an given key in a given store
set(key, value, store);
####parameters :
key : string 'choosedkey'
value : any value
store : string 'choosedstore' (optional, if not setted, standard store will be used)
####return :
boolean
true if the key could be setted, false if not
####example
$yamsClient->set('choosedkey', 'choosedvalue', 'choosedstore');
###del
deletes the given key and it's value from the given store
del(key, store);
####parameters :
key : string 'choosedkey'
store : string 'choosedstore' (optional, if not setted, standard store will be used)
####return :
boolean
true if the key could be deleted, false if not
####example
$yamsClient->del('choosedkey', 'choosedstore');
###inc
increments the value of an given key in the given store by 1
inc(key, store);
####parameters :
key : string 'choosedkey'
store : string 'choosedstore' (optional, if not setted, standard store will be used)
####return :
integer|boolean
integer value of the key if increment was sucessful, false if not
####example
$yamsClient->inc('choosedkey', 'choosedstore');
###dec
decrements the value of an given key in the given store by 1
dec(key);
####parameters :
key : string 'choosedkey'
store : string 'choosedstore' (optional, if not setted, standard store will be used)
####return :
integer|boolean
integer value of the key if decrement was sucessful, false if not
####example
$yamsClient->dec('choosedkey', 'choosedstore');
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment