#12 PHP Session caching (size limit patch)

open
nobody
None
5
2005-10-26
2005-10-26
Chris Thomas
No

hi, I've just made a session cache size limit patch
available in the patches section, it of course sits on
top of my other patches, grab the full one if you can,
it'll be easier on you.

added defines are

MAGPIE_CACHE_SOFTLIMIT
MAGPIE_CACHE_HARDLIMIT

you set these in a similar way to setting debugging, or
the location of the cache, or something equally
similar, they take bytes as a limit to what you can store

it only applies to the session cache, but I suppose
someone might come up with the idea of using it for the
file cache too, cause maybe they have limited space and
they want to limit the amount of cached data FULL STOP.

so thats a possibility, but right now, it's only
applicable to session caching

if you breach the soft limit, php complains, by
outputting a debugging statement saying you've breached
the limit

if you breach the hard limit, it WILL NOT CACHE, tough
luck

if you REALLY MUST cache but the hard limit is getting
in your way, redefine it and try again, but well, you
are responsible for the webhost kicking your ass for
attempting to cache 100MB of feed data into a session
variable (like I'm sure people are sick of people
hearing me say, but as soon as I stop saying it,
someone will post saying "my webhost is kicking my
ass...blah")

also fixed some inconsistencies through the code,
things like using functions which are defined to do
things, but then using the same code elsewhere too, so
I've removed the duplicated code and swapped it with a
function call to provide the same functionality.

Discussion

  • Chris Thomas
    Chris Thomas
    2005-10-26

    Logged In: YES
    user_id=682144

    removed the patch as it had a couple of debug statements
    which would print out regardless of whether debugging was
    enabled (odd, but I'll fix it) back in around 1 hour

     
  • Chris Thomas
    Chris Thomas
    2005-10-26

    Logged In: YES
    user_id=682144

    new patch uploaded, I found the problem magpie has two
    error systems, one for rss_fetch and a very similar one inside
    rss_cache

    I'm thinking that I should do something about that, it doesnt
    make sense for each to have differently working debugging
    and error systems, they perform almost 100% identical,
    except the rss_fetch version outputs error and debugging
    statements regardless of whether debugging is enabled

    I'll talk to kellan about it I think and see if there is a reason for
    it

     
  • Chris Thomas
    Chris Thomas
    2005-10-26

    drop into magpierss directory, patch -p1 < patchname.diff