Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 06 00:21
    Suor closed #429
  • May 05 20:13
    chepe4pi edited #429
  • May 05 19:03
    chepe4pi opened #429
  • Apr 17 07:47

    Suor on master

    Re-raise commit errors (#428) (compare)

  • Apr 17 07:47
    Suor closed #427
  • Apr 17 07:47
    Suor closed #428
  • Apr 17 07:47
    Suor commented #428
  • Apr 01 16:05
    yamnikov-oleg commented #428
  • Apr 01 08:02
    Suor commented #428
  • Mar 31 15:29
    yamnikov-oleg opened #428
  • Mar 29 08:32
    yamnikov-oleg commented #427
  • Mar 29 08:25
    Suor commented #427
  • Mar 29 08:22
    Suor commented #323
  • Mar 29 06:52
    yamnikov-oleg opened #427
  • Mar 28 13:04
    codeasashu commented #323
  • Mar 23 19:31
    abhinavsp0730 closed #426
  • Mar 23 19:31
    abhinavsp0730 commented #426
  • Mar 23 17:32
    acjh commented #426
  • Mar 23 11:51
    abhinavsp0730 opened #426
  • Mar 19 16:14
    abhinavsp0730 commented #425
Alexander Schepanovski
@Suor
why?
Your function doesn't depend on time, right?
Chetan Dhembre
@chetandhembre
it depend on time .. but i want to cache result on interval of time .. so result i will get 12:00 PM same result i will return for next 30 minutes
Alexander Schepanovski
@Suor
When you need to round your times to 30 min intervals then use that as arguments.
Chetan Dhembre
@chetandhembre
problem with that is if i invalidate data on 12:15 due to some bug or issue.. and then again cache result it will calcaulate result for 12:00 as i am sending things in 30 min interval
i hope i am able to explain my usecase
Alexander Schepanovski
@Suor
Should there be single result at each given time?
Chetan Dhembre
@chetandhembre
yeah
Alexander Schepanovski
@Suor
Then you should have single cache key not depending on anything
So cache a function without arguments and calc dates within it
Chetan Dhembre
@chetandhembre
it is not also possible my function gets start and end from another function .. i guess cacheops wont help me with my unique usecase
atleast function level cache
will use from cacheops import cache in this case
Alexander Schepanovski
@Suor
You can use custom key func here
Chetan Dhembre
@chetandhembre
like?
does cacheops provide this feature? it is in TODOS
Alexander Schepanovski
@Suor
def _key_func(func, args, kwargs, extra=None):
    start, end = args
    # ...
    return key

@cached_as(timeout=30 * 60, key_func=_key_func)
def _get_a(start, end):
    a = some_function_call(start, end)
    # Do not cache empty results
    if not a:
        raise UncachedResult(a)

    return a
Chetan Dhembre
@chetandhembre
this is great ..
Alexander Schepanovski
@Suor
I feel that you are overcomplicating though.
Chetan Dhembre
@chetandhembre
why i havent read it before
Alexander Schepanovski
@Suor
Because it's not documented
Chetan Dhembre
@chetandhembre
ok
Chetan Dhembre
@chetandhembre
btw thanks for cacheops
Alexander Schepanovski
@Suor
you are welcome
Chetan Dhembre
@chetandhembre
it just work.. like nginx and redis respect
Alexander Schepanovski
@Suor
Thanks
Harish Sundararaj
@harishzen
Hi. I'm wondering if there is any documentation out there comparing this with johnny cache?
Alexander Schepanovski
@Suor
Johnny-cache is not supported anymore, it's working analog is django-cachalot. The main difference between cacheops and both of them is that they invalidate entire table every time any changes to it is made whereas cacheops is granular.
Chetan Dhembre
@chetandhembre
can i use cacheops without django?
as our django app using cacheops do not want to use different lib for caching
Alexander Schepanovski
@Suor
The smart part of cacheops caches django ORM querysets and other things basing on that, so I can't see how it could be used without django.
Simple and file cache might be used separately, you'll still need django as dependency and to configure them
Not sure what's the issue with the app
Chetan Dhembre
@chetandhembre
I want to use simple cache.. but at start of cacheops it expect to read config from settings file
Chetan Dhembre
@chetandhembre
got it
Chetan Dhembre
@chetandhembre
i guess still i have some issue
from cacheops.simple import RedisCache
I am importing this
Alexander Schepanovski
@Suor
You can configure django with django.conf.settings.configure()
codegeschrei
@codegeschrei
Hey there! I just wanted to ask why caching in admin is turned off?
Alexander Schepanovski
@Suor
To be extra safe. And more for historical reasons, there were lots of limitations in invalidating m2m for example.
Another reason - caching for admin doesn't make sense anyway: low traffic, high updates, different queries than in the app. Useless bloat.
codegeschrei
@codegeschrei
Thanks for your fast response, too bad though, for my project it'd be a really good thing.
Alexander Schepanovski
@Suor
You can overwrite ModelAdmin.get_queryset()
Marcio Ribeiro
@b1n_twitter
How hard would it be to make cacheops work with Django 1.6?
Alexander Schepanovski
@Suor
You can just use cacheops 2.4.3
Marcio Ribeiro
@b1n_twitter
Will check it out, thanks
Shashank Parekh
@sp1rs
Small Issue.
Let say 2 things are running parallelly, first to get the object which is cached and second the object which is saving that object (That is invalidating the cache). So is it possible that before the get operation, the cache get invalidated and we get the wrong or nothing from the 1st operation?
Matthew Egan
@mattjegan
Hey, would anyone be able to answer this cacheops question? https://stackoverflow.com/questions/44821010/connecting-django-signal-handlers-in-tests
Alexander Schepanovski
@Suor
It's impossible to say anything without test code. Signal setup looks fine, you may just not using cacheops in your test code.
Sam Buckingham
@BuckinghamIO
Does cache ops potentially have issues with prefetch_related?