Hi! On 04/16/2008 07:49 PM Derick Rethans wrote: > On Thu, 10 Apr 2008, Tobias Schlitt wrote: >> On 04/10/2008 09:59 AM Derick Rethans wrote: >>> On Wed, 9 Apr 2008, Tobias Schlitt wrote: >>>> On 04/09/2008 02:13 PM Derick Rethans wrote:
>>>>> Sometimes you might not want the items stored in a higher stack level, >>>>> for example because of data size reasons. As an example, you want a 1mb >>>>> PDF file stored in a cache on disk, but definitely not in the memory >>>>> cache. How are we going to handle this? >>>> You need to create a dedicated cache storage for these files. >>> Why? I'm saying that this should be an option of every cache storage >>> that we have. Creating a whole new storage backend for just doing this >>> seems silly. I think it's particulary important for the memory caches >>> (in-memory, apc, shared-mem). >> It will overcomplicate the whole process, if you create such exceptions. >> In fact you need to either check the size of the data to store >> (impossible inside PHP) or need to devide by attribute or something, in >> which levels an item might be stored. This also unnecessaty raises >> complexity of the storage process, which again reducec performance. >> I also do not see a problem to create a dedicated storage for this. In >> fact you just need to create a new directory on your HD and instatiate >> the object. If you need such large items to be stored, you most probably >> want to store them on the HD anyway, so a dedicated storage that does >> not involve the overhead of the stack is desired here. > The problem of having a dedicated storage stack is that the application > then needs to start caring about in which storage stack to store a > specific file. I think you might be missing that I meant that in the > same storage for cache items, *some* of the items are going to be too > big. For example you're storing generated PDFs where most of them are > 100kb and a few others 10MB. Here you might not want the complexity of > having the application itself do this check as it might complicate the > application too much. I see your problem. However, you should not cache PDF files in memory anyway, but store them somewhere as PDF files and link to them. Reading a 100 MB PDF through PHP is overhead in itself, so you would not want to use Cache here anyway. > I don't see how it is impossible to figure out the size of the data to > store btw. I do not see any possibility to determine the size of a PHP variables content, without writing it to disc. Therefore you cannot determine which content to store where, without asuming that the most bottom storage in your cache is a file storage. If you want to go this way you need to implemnt the possibility to determine the size of a cache item on disc in the file system based storages (which is easy, but not conform to any of the other interfaces). In addition we will need to check in the stack itself, if a file system cache is among the stack storages, which will lead to unmaintainable code and performance loss. Regards, Toby -- Mit freundlichen Grüßen / Med vennlig hilsen / With kind regards Tobias Schlitt (GPG: 0xC462BC14) eZ Components Developer [EMAIL PROTECTED] | eZ Systems AS | ez.no -- Components mailing list [email protected] http://lists.ez.no/mailman/listinfo/components
