| Basic concepts: | |
| -key-value store | |
| -NoSql | |
| -Values with expiration/ good for security | |
| Commands (=> indicates the return expected) | |
| SET server:name “fido” | |
| – store based into a key | |
| SETNX | |
| – store if not exists values | |
| EXPIRE resource:lock 120 | |
| – set a value to exists only for some defined time | |
| TTL resource:lock 113 | |
| – gets the last duration time for the value | |
| – when its -2 the value doesnt doesnt exists | |
| – when its -1 the value doesnt have a expiration | |
| INCR | |
| – increment automaticly a number stored into a given key | |
| – its a atomic operation | |
| GET server:name => “fido”F | |
| – recover the value | |
| DEL | |
| – delete the key and his value | |
| – List Data Structure | |
| RPUSH | |
| – puts a new value at the end of the list | |
| LPUSH | |
| – put a new value in the start of the list | |
| LRANGE tableName startRange EndRange (-1 to all the list) | |
| – gives a subset of the list, 2 | |
| LLEN tableName => 3 | |
| – returns the number of elements on the table | |
| LPOP tableName => “something” | |
| – remove and returns the first element of a list | |
| RPOP tableName => “Something” | |
| – removes the last element of the list and returns it | |
| – Set data structure | |
| commands | |
| LPUSH, |