Opened 16 years ago
Closed 15 years ago
#4179 closed defect (bug) (invalid)
wp object cache ignores custom expire time
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.2 |
Component: | Administration | Keywords: | has-patch, cache, object cache |
Focuses: | Cc: |
Description
The current implementation of the WordPress object cache ignores the passed $expire value, And instead every object defaults to the hard-coded value of 900 seconds, unless defined otherwise.
Suggested Solution:
Set the modification date on the cache files to the time in the future when we want the object to expire.
Implementation:
I have included a patch to allow this to happen, any Cache calls which do not specify an expirary time are given the default expire time still, and there seem no problems setting file modification timestamps to the future.
Also in this patch i cleaned up the formatting, Changed any remaining '/' to DIRECTORY_SEPARATOR to keep in line with the rest of the file. (DIRECTORY_SEPARATOR was added in PHP 4.3.0, I assume thats WP's baseline as it was allready in use in the file). Should also fix any remaining issues with Windows not liking the Unix directory structure marker.
Also fixed a </P> nesting error in class->stats()
Attachments (2)
Change History (8)
#2
@
16 years ago
changed the diff, Uses explode() now instead of split(), should be faster, and split was causing a Regex error under Windows with '\' in the pattern.
#3
@
16 years ago
Unfortunately, PHP's baseline for WP is PHP 4.2. As for DIRECTORY_SEPARATOR - I'm pretty sure it's been around for a long time. You might be thinking of PATH_SEPARATOR which was added in PHP 4.3...
#4
@
16 years ago
Hmm, It seems your right. I'll note here that wp-settings still sets a minimum of PHP 4.1
Going off a comment (just below the section in this next diff), just using / on windows can cause some issues, So as a fix, If DIRECTORY_SEPARATOR not defined, Then define it to the correct seperator depending on OS.
It could do with a test from those with < PHP 4.3
cache expire patch