deliro / moka-py

A high performance caching library for Python written in Rust
MIT License
90 stars 0 forks source link

What types of objects can be cached? #1

Closed stevesimmons closed 3 days ago

stevesimmons commented 6 days ago

Thanks for this project!

As the title asks, what types of objects can be cached? Does moka support any Python object? Or only ones that can be serialized/deserialized in some way?

Could you please add something to the README explaining this?

alwavshumilin commented 6 days ago

Key must be hashable and as for the value everything goes (everything that is PyObject of course)

Type hints are here: https://github.com/deliro/moka-py/blob/master/moka_py/__init__.pyi#L5-L4

deliro commented 5 days ago

Hi! As @alwavshumilin said, key must be Hashable and value can be arbitrary Python object. moka-py doesn't serialize or deserialize values, it stores their references instead.

Thank you for the question! I'll update docs to clarify this