django-cacheback icon indicating copy to clipboard operation
django-cacheback copied to clipboard

QuerySetJob cannot be queried using `get_or_create` method.

Open shubham2892 opened this issue 8 years ago • 3 comments

shubham2892 avatar Jun 07 '16 11:06 shubham2892

As the QuerySetJob should be used for caching purposes, I think its ok if get_or_create is not supported. Can you provide a use case which required get_or_create on QuerySetJob?

stephrdev avatar Jun 07 '16 13:06 stephrdev

The use case is same as of get_or_create in general when we want to fetch the entry if exists, if not create and then fetch. With this, it will also cache it after creating the entry.

shubham2892 avatar Jun 08 '16 14:06 shubham2892

How yould you handle the "created" flag in this case? To be consistent, it should only be true for the first "get" call. Later cached "get" calls would need to return False for "created".

stephrdev avatar Nov 24 '16 11:11 stephrdev