Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Nov 26, 2023
1 parent a93d1a9 commit 37292c4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ Summary

``df-diskcache`` is a Python library for caching ``pandas.DataFrame`` objects to local disk.

.. image:: https://badge.fury.io/py/df-diskcache.svg
:target: https://badge.fury.io/py/df-diskcache
:alt: PyPI package version

.. image:: https://img.shields.io/pypi/pyversions/df-diskcache.svg
:target: https://pypi.org/project/df-diskcache
:alt: Supported Python versions

.. image:: https://github.com/thombashi/df-diskcache/actions/workflows/ci.yml/badge.svg
:target: https://github.com/thombashi/df-diskcache/actions/workflows/ci.yml
:alt: CI status of Linux/macOS/Windows
Expand Down Expand Up @@ -90,6 +98,28 @@ You can also use operations like a dictionary:
print(df)
Set TTL for cache entries
--------------------------------------------

:Sample Code:
.. code-block:: python
import pandas as pd
from dfdiskcache import DataFrameDiskCache
DataFrameDiskCache.DEFAULT_TTL = 10 # you can override the default TTL (default: 3600 seconds)
cache = DataFrameDiskCache()
url = "https://raw.githubusercontent.com/pandas-dev/pandas/v2.1.3/pandas/tests/io/data/csv/iris.csv"
df = cache.get(url)
if df is None:
df = pd.read_csv(url)
cache.set(url, df, ttl=60) # you can set a TTL for the key-value pair
print(df)
Dependencies
============================================
- Python 3.7+
Expand Down
2 changes: 1 addition & 1 deletion dfdiskcache/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__author__ = "Tsuyoshi Hombashi"
__copyright__ = f"Copyright 2023, {__author__}"
__license__ = "MIT License"
__version__ = "0.0.1"
__version__ = "0.0.2"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"

0 comments on commit 37292c4

Please sign in to comment.