Skip to content

Commit

Permalink
refresh readme
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Jun 9, 2023
1 parent c4d938a commit b867166
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ Cachew gives the best of two worlds and makes it both **easy and efficient**. Th


# How it works
Basically, your data objects get [flattened out](src/cachew/__init__.py#L409)
and python types are mapped [onto sqlite types and back](src/cachew/__init__.py#L481).
Basically, your data objects get [flattened out](src/cachew/__init__.py#L411)
and python types are mapped [onto sqlite types and back](src/cachew/__init__.py#L483).

When the function is called, cachew [computes the hash of your function's arguments ](src/cachew/__init__.py:#L810)
When the function is called, cachew [computes the hash of your function's arguments ](src/cachew/__init__.py:#L868)
and compares it against the previously stored hash value.

- If they match, it would deserialize and yield whatever is stored in the cache database
Expand All @@ -135,18 +135,18 @@ and compares it against the previously stored hash value.



* automatic schema inference: [1](src/cachew/tests/test_cachew.py#L352), [2](src/cachew/tests/test_cachew.py#L366)
* automatic schema inference: [1](src/cachew/tests/test_cachew.py#L353), [2](src/cachew/tests/test_cachew.py#L367)
* supported types:

* primitive: `str`, `int`, `float`, `bool`, `datetime`, `date`, `dict`, `list`, `Exception`

See [tests.test_types](src/cachew/tests/test_cachew.py#L678), [tests.test_primitive](src/cachew/tests/test_cachew.py#L715), [tests.test_dates](src/cachew/tests/test_cachew.py#L632)
* [Optional](src/cachew/tests/test_cachew.py#L496) types
* [Union](src/cachew/tests/test_cachew.py#L788) types
* [nested datatypes](src/cachew/tests/test_cachew.py#L412)
* [Exceptions](src/cachew/tests/test_cachew.py#L1037)
See [tests.test_types](src/cachew/tests/test_cachew.py#L679), [tests.test_primitive](src/cachew/tests/test_cachew.py#L716), [tests.test_dates](src/cachew/tests/test_cachew.py#L633)
* [Optional](src/cachew/tests/test_cachew.py#L497) types
* [Union](src/cachew/tests/test_cachew.py#L794) types
* [nested datatypes](src/cachew/tests/test_cachew.py#L413)
* [Exceptions](src/cachew/tests/test_cachew.py#L1043)

* detects [datatype schema changes](src/cachew/tests/test_cachew.py#L442) and discards old data automatically
* detects [datatype schema changes](src/cachew/tests/test_cachew.py#L443) and discards old data automatically


# Performance
Expand All @@ -157,17 +157,17 @@ During reading cache all that happens is reading rows from sqlite and mapping th
I haven't set up proper benchmarks/performance regressions yet, so don't want to make specific claims, however that would almost certainly make your programm faster if computations take more than several seconds.


If you want to experiment for youself, check out [tests.test_many](src/cachew/tests/test_cachew.py#L296)
If you want to experiment for youself, check out [tests.test_many](src/cachew/tests/test_cachew.py#L297)



# Using
See [docstring](src/cachew/__init__.py#L674) for up-to-date documentation on parameters and return types.
See [docstring](src/cachew/__init__.py#L695) for up-to-date documentation on parameters and return types.
You can also use [extensive unit tests](src/cachew/tests/test_cachew.py) as a reference.

Some useful (but optional) arguments of `@cachew` decorator:

* `cache_path` can be a directory, or a callable that [returns a path](src/cachew/tests/test_cachew.py#L389) and depends on function's arguments.
* `cache_path` can be a directory, or a callable that [returns a path](src/cachew/tests/test_cachew.py#L390) and depends on function's arguments.

By default, `settings.DEFAULT_CACHEW_DIR` is used.

Expand Down Expand Up @@ -260,7 +260,7 @@ Now you can use `@mcachew` in place of `@cachew`, and be certain things don't br
## Settings


[cachew.settings](src/cachew/__init__.py#L41) exposes some parameters that allow you to control `cachew` behaviour:
[cachew.settings](src/cachew/__init__.py#L45) exposes some parameters that allow you to control `cachew` behaviour:
- `ENABLE`: set to `False` if you want to disable caching for without removing the decorators (useful for testing and debugging).
You can also use [cachew.extra.disabled_cachew](src/cachew/__init__.py#L18) context manager to do it temporarily.
- `DEFAULT_CACHEW_DIR`: override to set a different base directory. The default is the "user cache directory" (see [appdirs docs](https://github.com/ActiveState/appdirs#some-example-output)).
Expand Down

0 comments on commit b867166

Please sign in to comment.