yaph / fscache

A Python package for caching data in the file system.

Home Page:https://pypi.org/project/fscache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fscache

fscache is a Python package for caching data in the file system.

Installation

pip install fscache

Usage

import requests
from fscache import fscache

url = 'https://example.com/index.html'
cache_file = fscache.path(url, cache_dir='.fscache')

if fscache.valid(cache_file, lifetime=3600):
    content = fscache.load(cache_file)
    # Do something with content
else:
    content = requests.get(url).text
    # Save content in .fscache/https/example.com/index.html
    fscache.save(cache_file, content)

License

MIT © Ramiro Gómez

About

A Python package for caching data in the file system.

https://pypi.org/project/fscache

License:MIT License


Languages

Language:Python 89.9%Language:Makefile 10.1%