# Memcache caching
## How to calculate infinite expiration timestamp
1. open SSH connection to a web server (or where the Memcache is installed)
2. run this command:
```
lang=bash
(sleep 1; echo "stats"; sleep 1; echo "quit";) | telnet localhost 11211 | grep 'time'
```
Example output:
```
STAT uptime 61335
STAT time 1676435743
```
3. subtract the number after the `uptime` word from the number after the `time` word (e.g. `1676435743 - 61335 = 1676374408`) and remember this number
## How to determine key expiration
1. open SSH connection to a web server (or where the Memcache is installed)
2. run this command:
```
lang=bash
(sleep 1; echo "stats cachedump slab_number_here 0"; sleep 1; echo "quit";) | telnet localhost 11211 | grep 'key_name_here'
```
Example output:
```
ITEM key_name_here [value_here b; timestamp_here s]
```
3. if no data is returned try incrementing the `slab_number_here` parameter by 1 and running that command again
4. if the number in place of the `timestamp_here` text matches the infinite expiration timestamp, then the key will never expire
5. otherwise the key will expire at the given date/time
# Database caching
## How to determine key expiration
# open the database (e.g. via phpMyAdmin)
# execute the `SELECT LifeTime FROM SystemCache WHERE VarName = 'key_name_here';` database query
# if you'll get `-1` it means, that the key won't automatically expire
# if you'll get a timestamp it means, that the key will expire after that time
# Actual tests
## TODO