Hi!

On Oct 26, 2007, at 4:07 AM, [EMAIL PROTECTED] wrote:

>
>> maybe I'm a bit confused (or tired) but
>> how would you go and cache a view that will *never*
>> change depending on a request on my application?
>
> Is the output something difficult for the view to generate?

No, it's just a massive amount of views. (14k)

> If not,
> you could just specify a very long cache expiration and let it
> regenerate itself as needed. If you're using memcached, it's going to
> be stored in RAM and is subject to being wiped out if the process
> restarts, so you really can't rely on  it being there. If it is an
> expensive view to process, the next request after the cache expiry
> would be an unlucky visitor; this may not be a great option in that
> case.

I thought about memcache too, but I have limited ram space and a lot
(14k) records that needs to be cached.

>
>> If I read the manual right, I have to give a timeout to
>> all the cache functions that are available. In my case I have
>> a view that will never change... so I don't really
>> know how to do this.
>
> If you *really* need it to write once, you could write a couple of
> methods that will write and load the output to/from the file system.

Ok, I think I really have to do that.

> At the beginning of your view, you could use the getter method to look
> on the filesystem for the file the same way the cache api does a
> lookup. (Keep in mind that filesystem lookups are going to incur more
> I/O latency than Memcached)

I don't think that memcached is faster than file io.
I may be wrong, but Fredrik Lundh stated that it's not the case [1]
(at least for his effbot page).

>
> FWIW, If you do follow this route, I'd suggest putting the filesystem
> path in your settings file to make the application more portable.
>
> Hope this helps.

Helps in the case that I was on the right road, thanks. :)
I thank you for your response. So it seems that I
do have to create it on my own.

If anyone did something like this before or has
performance tips or something else please share.

[1]: http://effbot.org/zone/zone-django-notes.htm

Greetings :)
Kai




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to