I am not quite sure if this is the right mailinglist but as long as my
remarks are about a core-component of django I hopefully chose the right
list.
Dealing with cache-stuff in Django I realized that it seems to be
impossible to use a timeout=0 (which in terms of memcached meant that
the item would never expire unless it has to make way for new items due
to memory shortage). This is because even still in the most current
trunk-version the timeout is calculated (in
django.core.backends.memcached.CacheClass._get_memcache_timeout) as
timeout = timeout or self.default_timeout
where timeout is one of the parameters given to _get_memcache_timeout.
So as long as timeout=0 always the default_timeout will be used.
Maybe this behaviour is intended to prevent memcached being filled up
with items that never expire.
In my opinion it may be better to enable developers to use the
timeout-values as intended by memcached (where 0 means no expiration at
all).
So I would like to suggest to change the default value in all method
signatures of the memcached.CacheClass (and whereever it whould be
necessary) from 0 to None and to replace the line above by an if-clause as
if timeout is None:
timeout = self.default_timeout
This is not as elegant as the original version but now it would be
possible to use 0 as a timeout.
If it would help I can try to open a ticket and provide a first path
against the current trunk.
With best regards
Carsten Reimer
--
Carsten Reimer
Web Developer
carsten...@galileo-press.de
Phone +49.228.42150.73
Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Phone +49.228.42150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/
Managing Directors: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
+1
Sent from my mobile device.
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
2010/7/16 Tobias McNulty <tob...@caktusgroup.com>:
--
Sergej Dergatsjev
E-mail: sergej.d...@gmail.com
Skype: SergejDergatsjev
Site: http://www.eecho.info
Sounds reasonable to me. This is a useful feature of the most useful
caching backend library. It makes sense that we should support that
feature, and the API approach you describe makes sense to me.
If you open a ticket and provide a patch (with docs to describe the
change), then this sounds like a good addition.
Yours,
Russ Magee %-)
FTR this exact same concept has been filed before, and closed wontfix
on backwards compatibility concerns (see Mike Malone's scaling Django
slides, where he's mentioned this several times).
Alex
--
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me
Really? What concern? Can you point at a ticket discussion?
Yours,
Russ Magee %-)
Is this the ticket you were thinking of? It seems to have been reopened.
Cheers,
Will Hardy
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
I agree.
> Furthermore, correct me if I'm wrong, but:
> timeout = timeout or self.default_timeout
> seems like an oversight on the part of whoever wrote that line originally,
I think that "whoever" was me, and I think you're right that it should
have been more like `timeout = self.default_timeout if timeout is None
else timeout` (or the equivalent 2.4 syntax).
I'd bless a patch making that simple fix. It's very slightly backwards
compatible, but almost certainly in a good way, so I'm fine with the
change.
Jacob
It's not obvious to me why .extra or .raw are the appropriate analogyhere, instead of the rest of the ORM API, which does attempt to
present the same semantics regardless of backend.
The argument that "you know what cache backend your project uses" does
not apply to the significant ecosystem of caching-related reusable
Django code: johnny-cache, cache-machine, cachebot, and more.
Last week I uploaded a patch to #6447 that maintains cross-backend
parity of allowed cache keys (without any performance hit on
memcached) by making sure the other backends will reject the same keys
memcached will reject. You approved this approach on IRC, Jacob, so
given the discrepancy I'm just curious whether it is in fact a design
goal to have semantic parity between the backends shipped with Django.
I agree with Carl.
We have an abstracted api - having a property with different meanings
for different backends makes things a lot less pluggable.