[FX.php List] FXNeoCache

Nick whatdoyouwant at gmail.com
Fri Aug 8 22:02:47 MDT 2008


just caching the findall will work well.

however, storing individual finds in cache is doable with my code, i'll send
it your way this next week.
It's really simple and all it does is allow a string for the cache file
name, (it is required to be set along with the lifetime of the cache file)
example php:

$fx_findbook->unique = 'myfind/findbook/book_'.intval($_GET['booknum']);

Setting the unique variable caches the find request and makes it unique
(because that's all i'm searching on)
The more parameters you have the more this could get out of hand.

You do have to be careful  to validate the text you concatenate to the
unique variable as it gets used to create a directory/file in the fx_cache
folder.  I believe my code does some of this but it's always good if you
control your data.

-Nick

2008/8/5 biscuit technologies <biscuit.tech at gmail.com>

> Sorry, I should have taken the 30 seconds to think through my code before
> replying.
> I had both my find and my findall caching and I only needed my findall to
> be cached.
>
> Or, not?
>
> Please tell me if this is just wrong-headed. It appears to work now.
>
> - David
>
>
>
> 2008/8/5 Roger Price <rp272 at cam.ac.uk>
>
>  David
>>
>> I am somewhat confused by your statement regarding a cached page!
>> FXNeocache only caches a particular 'find' (if it does not already exist).
>> The next time the page is called it will check to see if there is a cached
>> version and whether it has expired. If it has not it uses that data,
>> otherwise it performs the find again uses the result and stores it as well.
>>
>>
>> 'The script is of course caching this found set without acknowledging the
>> find parameters and so returning the same result for any subsequent search
>> until the cache expires.'
>>
>> Well isn't that what a cache is supposed to do?
>>
>> Do I infer that you are trying to use FXNeocache for a search where the
>> values used change every time?
>>
>> Nick uses the 'GET' parameter 'nocache' while I use 'refresh'. Both cause
>> the cache to be updated if data has been changed in the database and I don't
>> want to wait until the cache expires normally.
>>
>> I'm sorry if this is not what you are wanting to hear but I'm not sure
>> what you are hoping to achieve.
>> kindest regards
>>
>> Roger
>>
>>
>>
>>  *From:* biscuit technologies <biscuit.tech at gmail.com>
>> *Sent:* Tuesday, August 05, 2008 7:45 PM
>> *To:* FX.php Discussion List <fx.php_list at mail.iviking.org>
>> *Subject:* Re: [FX.php List] FXNeoCache
>>
>> Hi Roger and Nick, This is very encouraging. I'd be interested in looking
>> at both your modifications if you don't mind and seeing if I can fold them
>> into my site.
>>
>> I've found a problem and I'm not sure if your files will fix it or not. On
>> my cached page I have a search that returns via GET the same page with the
>> same URL. The script is of course caching this found set without
>> acknowledging the find parameters and so returning the same result for any
>> subsequent search until the cache expires.
>>
>> Would your fix address this or do I need to send search results to a new
>> page?
>>
>> Thanks,
>> David
>>
>> 2008/8/3 Nick <whatdoyouwant at gmail.com>
>>
>>> I too use a modified version of FXneocache and I added the 'unique'
>>> parameter as well, but mine is basically a folder and file name parameter
>>> that you could append php values to as well.  That ,along with the parameter
>>> lifetime, lets me use file caching.  I also allow for a GET parameter - mine
>>> is 'nocache' that updates the cache.  (just like David)
>>>
>>> The current state of FXneocache might be my fault as I was working with
>>> the original developer for a little while, but then he stopped responding to
>>> any emails like David said as well.  I think that he uses the mysql portion
>>> and it doesn't translate well to the file portion.  Some of the problems
>>> with the current edition out there have to do with path length and some OS's
>>> that don't support huge paths (which an entire URL as the parameter can make
>>> very long sometimes).
>>> -Nick Salonen
>>>
>>>
>>>  2008/8/1 Roger Price <rp272 at cam.ac.uk>
>>>
>>>>  David
>>>>
>>>> I first learned about FXNeocache on this list and have implemented it on
>>>> my site.
>>>>
>>>> I have a menuing system that is database driven and which does not
>>>> change all that often. This seemed to be an ideal candidate for caching!
>>>>
>>>> It was easy to install and implement and I began to see real benefits
>>>> but discovered that if I made a change and forced a refresh on say the home
>>>> page then the change was not replicated on other pages I tried. Over time
>>>> the performance seemed to drop off.
>>>> A quick read of the code showed the reason was that parameters from each
>>>> find were concatenated with the page's URL to create the name of the cached
>>>> data. A visit to the folder where the caches were stored showed hundreds of
>>>> cached files (all containing the same data).
>>>>
>>>> I made a modification to the FXNeocahe code to permit a additional
>>>> parameters to be passed to the function. One of these was 'unique' with the
>>>> values of 1 for true and 0 for false. When 'unique = 0' the cache name was
>>>> created without URL and thus was identical for every instance of my menu.
>>>>
>>>> Having a short TTL defeats the purpose of using a cache if it is
>>>> regularly expiring and needing to be recreated. However in the case of my
>>>> menu which was set at 6 hours it was frustrating to make a change and then
>>>> wait until the cache expired. It was possible to do this from within the
>>>> page code but it had to be reset back afterwards. I added a feature that
>>>> tested for two 'get' values that could be appended to a page URL  viz
>>>> ?refresh=1&debug=1 the first forces the cache to expire (and recreated with
>>>> new data) and the second turns on the debug info on.
>>>>
>>>> I tried to share this with the authors of FXNeocache but they were not
>>>> interested in the slightest.
>>>>
>>>> If any of these feature are of interest to you please contact me
>>>> off-list and I will send you a copy of the appropriate file.
>>>>
>>>> FXNeocache has been working most satisfactorily for many months now and
>>>> I almost take it for granted. It does as you have discovered seriously
>>>> improve performance but only in the appropriate circumstances.
>>>>
>>>> Roger
>>>>
>>>>
>>>>
>>>>
>>>>  *From:* biscuit technologies <biscuit.tech at gmail.com>
>>>> *Sent:* Friday, August 01, 2008 7:37 PM
>>>> *To:* FX.php Discussion List <fx.php_list at mail.iviking.org>
>>>> *Subject:* [FX.php List] FXNeoCache
>>>>
>>>> Hi, I've got an FX page that on load is pulling a pretty large data set
>>>> of almost completely static data and so I've set up NeoCache to reduce the
>>>> page load (went from 20 seconds to 3!).
>>>>
>>>> I remember seeing a post not too long about NeoCache creating some
>>>> problems over time - but I couldn't find it in the archive.
>>>>
>>>> Does anyone have any tips to avoid problems or any warnings in general?
>>>>
>>>> thanks,
>>>> David
>>>>
>>>> ------------------------------
>>>>
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>>
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>>
>>  ------------------------------
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20080808/db9e0cf9/attachment-0001.html


More information about the FX.php_List mailing list