Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion includes/Traits/TransientCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,23 @@ private static function get_transient_version( $group, $refresh = false ) {
if ( false === $transient_value || true === $refresh ) {
$transient_value = static::get_time_prefix();

set_transient( $transient_name, $transient_value );
/**
* Filters the lifetime of a cache group's transient-version marker.
*
* A marker stored without an expiration is autoloaded by WordPress and never
* cleared, bloating autoloaded options on sites without a persistent object
* cache. Giving it a TTL makes WordPress store it as `autoload = no` and lets
* core garbage-collect it. The value must outlive the longest-lived data
* transient in any group, otherwise the group is invalidated prematurely.
*
* @since DOKAN_SINCE
Comment thread
MdAsifHossainNadim marked this conversation as resolved.
*
* @param int $expiration Marker lifetime in seconds. Default 1 month.
* @param string $group Cache group the marker belongs to.
*/
$expiration = apply_filters( 'dokan_cache_transient_version_expiration', MONTH_IN_SECONDS, $group );

set_transient( $transient_name, $transient_value, $expiration );
Comment thread
MdAsifHossainNadim marked this conversation as resolved.
}

return $transient_value;
Expand Down
Loading