# # Cache management

Foxit PDF SDK for Web Server uses `S8_WEBPDF_CACHE_DIRS`to specify a share storage for caching data. The cached contents contains PDF documents, and the parsed document data such as page, annotation, form and ect. In distributed deployments, commonly a file share (i.e. Samba, k8s ceph ) is created and mounted as a cache directory for transmitting and sharing data over nodes.

## # Cache clear policy

Cache clear is controlled by two variables, `S8_WEBPDF_CACHE_AGE` and `S8_WEBPDF_CACHE_MB`, which represents the minimum cache retention time (mins) and the maximum capacity allowed (MB). Additionally, a file is not removed when its last access time is less than 30 minutes.If one or both of these two variables are set, they will be used according to their priority:

- If the cache time is <30 mins: No Clear
- If the cache duration is > S8_WEBPDF_CACHE_AGE: Clear
- If the cache volume is > 0.8*S8_WEBPDF_CACHE_MB: Clear

When do cache clearing, Foxit PDF SDK for Web Server will sort by the earliest access time and delete item by item until conditions are met.