python - How to cache a row instead of an model instance when using SQLAlchemy? -
i'm using sqlalchemy
python-memcached
.
before using real sqlalchemy
query, first check if corresponding key cached, , in case it's not cached set
found instance (which sqlalchemy model object) in cache.
for of functions fast enough, in functions thousands of objects queried, fair amount of time spent in cpickle.loads
deserialising objects.
because serialisation , deserialisation of tuple/dict row several times faster of object, i'm wondering if can somehow cache row instead.
you use dogpile cache package this.
there's example of usage on sqlalchemy documentation website.
Comments
Post a Comment