Exporting some of the `datetime` functions from `django.utils.timezone`

2023-03-18 Thread suayip uzulmez
Most of the time I use `timezone.now` in conjunction with `timezone.timedelta`, however, today I realized it was not publicly exported in the module. Most of the time, using it saves an import from `datetime` (e.g., timezone.now + timezone.timedelta is a common pattern). I presume this use ca

Re: A generic cache decorator around low level cache api

2023-01-07 Thread suayip uzulmez
3855af9ac > > This would give the simplicity of using a @cache_results decorator, > while allowing to bypass or refresh the cache when needed. > > I’m not sure but likely there are some packages that have a similar > function. > > Best, > Diederik > > Op 2 jan. 2023, om 1

Re: A generic cache decorator around low level cache api

2023-01-02 Thread suayip uzulmez
I would like to see more opinions on this, I am using this type of utility in almost every project I make and it seems to me it would a decent utility function. 26 Ağustos 2022 Cuma tarihinde saat 14:45:13 UTC+3 itibarıyla suayip uzulmez şunları yazdı: > It doesn't necessarily have

Re: A generic cache decorator around low level cache api

2022-08-26 Thread suayip uzulmez
rySets are lazy, so it could > be surprising to decorate a function that returns a QuerySet that is not > yet resolved. > > On Wed, Aug 24, 2022 at 3:49 PM suayip uzulmez wrote: > >> Usually, I need to construct a simple cache pipeline to optimize database >> access us

A generic cache decorator around low level cache api

2022-08-24 Thread suayip uzulmez
Usually, I need to construct a simple cache pipeline to optimize database access using low-level cache API (django.core.cache). I think we could use a decorator as such to ease this process: cached_context(key, *, timeout, cache) I know higher-level utilities exist such as cache_page, however I