Opened 16 years ago
Closed 16 years ago
#9048 closed enhancement (fixed)
Don't cache to options table if object cache installed
Reported by: | ryan | Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
RSS feeds, rewrite rules, and other things that should be in a cache are actually stored in the options table since the default cache does not persist data beyond the current page load. For blogs where an object cache backend that persists across page loads is installed, we should move these "options" out of the options table and into the cache.
My suggestion is to add a set of *_transient() functions that are used instead of *_option() for transient data that really belongs in the cache. An alternative is to have the *_option() functions check a list of options that should be transient and send transients to the cache instead of the options table. Plugins could add to the list.
Attachments (2)
Change History (15)
#1
@
16 years ago
Patch implements *_transient() API and switches rewrite_rules and the RSS cache to it.
#2
@
16 years ago
An alternative is to have the *_option() functions check a list of options that should be transient and send transients to the cache instead of the options table.
Is there any chance that plugins will be calling the *_option() functions on these transient "options?" If so, they'll get a different result than *_transient() would. Then again, we might not care. The data is transient, after all.
#3
@
16 years ago
Then again, we might not care. The data is transient, after all.
If theres any plugins using it (ie. a Feed replacement plugin) thenit'd be best to encourage them to use it too i would think..
Theres very few cases where a plugin would need direct access to most of the mentioned items.
#4
follow-up:
↓ 5
@
16 years ago
Perhaps we could have autoload = yes|no|transient, so things like _transient_flush()
(delete all transient items) would work. Or maybe add another column to the options table to mark entries as transient.
#5
in reply to:
↑ 4
@
16 years ago
The RSS stuff is buried in the Magpie class and rewrite_rules should be accessed through WP_Rewrite::wp_rewrite_rules(), so I don't think plugins should be doing get_option() on them.
#6
@
16 years ago
Maybe we should/could rename the things we are marking as transient to ensure there is no issue.
Sample implementation of *_transient()