question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hello! I think it would be interesting having a section in Starlette docs documenting how to use caching as this is something you end up doing typically for lots of services.

I’m the maintainer of aiocache which is a caching framework agnostic to any http framework. I could write docs about things like:

  • how to use aiocache with starlette for caching endpoints
  • how to write configuration for caching and load it when starting a Starlette app

Any other thing you could think of you usually do when setting caching for your app. Also happy to receive comments, issues and PRs if you think there is anything missing to integrate nicely with Starlette 😃.

Would you be interested on me providing a PR documenting that? A new section called “Caching” in https://www.starlette.io/ maybe?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:28 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
florimondmancacommented, Nov 5, 2019

@patrys Yup, and if you look closely you’ll see that async-caches is a dependency for asgi-caches. I initially thought of adding the ASGI functionality to async-caches via a PR, but figured that the nice frontier between the generic async world (async-caches) and the ASGI world (asgi-caches) would make things easier to maintain and iterate. As with many third-party ASGI libraries, there is room on my side for eventually merging it into Starlette, provided built-in caching support in Starlette is on the roadmap.

1reaction
argaencommented, Mar 26, 2019

I’m not sure I’d use a decorator in that way in many uses cases - if there’s any aspect of the page that varies by user-authentication, then it’s not going to work. Really you want HTTP-level caching for that kind of functionality.

yep, that’s what I thought and why I think its complex to support this, but not sure if passing the whole request object all the way is a common pattern for users.

I’m also not quite sure what you mean when you describe the behavior. We could add an eq to Request […]

yeh not 100% comfortable with this though, there are many things involved in a request that can make it different. I’ll go with an example showing how to cache an expensive function call and an http caching middleware plus how to link this with the config. Once I’ll have it we can discuss a bit more with real examples 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring cache backends - Apollo GraphQL Docs
You can specify a cache backend by passing a cache option to the ApolloServer constructor. Your specified cache backend must implement the KeyValueCache ......
Read more >
What is Caching and How it Works - AWS
Database caching allows you to dramatically increase throughput and lower the data retrieval latency associated with backend databases, which as a result, ...
Read more >
Backend Caching - cBioPortal Docs
cBioPortal provides the option of caching information on the backend to improve performance. Without caching, every time a request is received by the ......
Read more >
Cache storage backends - Docker Documentation
Cache storage backends. To ensure fast builds, BuildKit automatically caches the build result in its own internal cache.
Read more >
Django's cache framework
Unlike other cache backends, the database cache does not support automatic ... To use this backend set BACKEND to "django.core.cache.backends.filebased.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found