Giter VIP home page Giter VIP logo

Comments (5)

sorl avatar sorl commented on June 2, 2024

So, you're trying to implement a cache (based on django cache backend) only?
I never said the django.cache is enough for you to implement a proper key value store enough to cover the needs of the current implementation and infact I don't think its such a great idea to have only non-persistent cache.
Well we need to query the key value store at least once each time for each thumbnail, that should be alot faster than quering the storage backend, thats the whole idea. Do you have some other idea on how this should work? please elaborate in that case so that I could take it in consideration.

from sorl-thumbnail.

hvdklauw avatar hvdklauw commented on June 2, 2024

The point is that django has a cache system in place.
The thing is, I have the caching setup with memcache, which is used everywhere. So now with the new sorl thumbnail is have the choice between taking tons of database queries or get redis installed on production.

Django cache framework is an abstraction layer which makes it easy to use everywhere and then on time of deployment I can pick the backend I want to use.
It might be redis, it might be memcache and for local development I can use locmem.

You could extend the snippet a bit and specify a thumbnail specific timeout for the cache.set. Thus making the keys lasts longer.

Also, yes, cache is faster then the storage backend, but what if I don't care? Right now you force one way of doing it which is totally different from the previous version.

from sorl-thumbnail.

sorl avatar sorl commented on June 2, 2024

But the cached db key value store doesn't take a database hit after first query, its loaded into memcached after that (or whatever cache backend you are using). Why don't you want to use this?

i know that the _find_keys_raw method is a bit narrow and I realize that all "key value" stores might not be able to implement this. One approach around the problem would be to keep track of the different 'identities' and keys in special keys, but I rather not, in case this grows to a real problem I will have to figure out a "nicer" way to solve those problems on a more fundamental level. Anyway, as I said I don't think using the django.cache as a key value store is a valid enough use case since I don't think its a good idea.

from sorl-thumbnail.

hvdklauw avatar hvdklauw commented on June 2, 2024

Ah.. I totally missed it cached because the cache_backend was set to dummy.

My bad :D

from sorl-thumbnail.

sorl avatar sorl commented on June 2, 2024

Finally if you don't want to use a Key Value Store at all, then just make your own Backend subclass that just looks at the storage or something, that should be an easy job. I am not forcing you to do anything, infact I'd go as far as saying the new design is very modular.

from sorl-thumbnail.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.