Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add aiocache for tile cache #207

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

vincentsarago
Copy link
Member

@vincentsarago vincentsarago commented Feb 22, 2025

@callsumzg would love to get your opinions on this.

aiocache seems like the only python async lib of cache. Its seems extensible so users could provide its own cache backend or use one of the predefined classes

@callsumzg
Copy link
Contributor

@vincentsarago I'm at a conference this week, but I'll try to check it out.

@callsumzg
Copy link
Contributor

callsumzg commented Feb 26, 2025

@callsumzg would love to get your opinions on this.

aiocache seems like the only python async lib of cache. Its seems extensible so users could provide its own cache backend or use one of the predefined classes

Finally had time to look into it. If i am honest, i'm not the biggest fan of relying only on one specific caching library. As far as i can tell, the draft also relies on a global config, which would make it not so easy to extend or modify later? But the main thing is that the library aiocache seems to be restricted to redis, memory and memcache, or not? all good solutions when you have not so much data and/or lots of memory/money :-) but as soon as you have more data and also want to pretile (which i am a big fan of, i would not implement on-demand caching for the most requested zoomlevels), you could run into some problems. I would rather implement a more modular approach with an abstract layer by defining a base cache interface and then implementig separate backend classes for file, redis, s3, sqlite/mbtiles, etc. This would have the benefits of decoupling the caching mechanism from the rest of the application and if you want to support a new caching backend (e.g geopackage, azureblob) it is as simple as adding a new implementation without changing the core code. For example if we implemented several separate caching backends, one for file caching, one for redis, one for s3, and suddenly we have to replace the s3 library because it is not maintained anymore, we would only need to replace/update the specific code for the s3 and not as well for all the other cache-backends. :-)

I dont know if i explained what i mean clearly. If you give me some time, i can put together a draft so you can see what i mean. 🙈😅

Btw, the redis-py library includes a built in async support too

@vincentsarago
Copy link
Member Author

Quick note:

But the main thing is that the library aiocache seems to be restricted to redis, memory and memcache, or not

You can write your own aiocache backend (e.g. ondisk), but by default it only provide those 3 backends.

which would make it not so easy to extend or modify later

It wont if you were using tipg as it is but the idea of tipg is usually to be extended/customized to fit user needs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants