Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use transients as storage as a fallback. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
8 changes: 6 additions & 2 deletions time-stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public static function get_data( $clear = false ) {

if ( function_exists( 'apc_store' ) && apc_store( '__test', '123' ) ) {
$data = apc_fetch( '_hm_all_stacks' );
} else {
} elseif ( wp_using_ext_object_cache() ) {
$data = wp_cache_get( '_hm_all_stacks' );
} else {
$data = get_transient( '_hm_all_stacks' );
}

if ( $clear )
Expand All @@ -39,8 +41,10 @@ public static function set_data( $data ) {

if ( function_exists( 'apc_store' ) && apc_store( '__test', '123' ) ) {
return apc_store( '_hm_all_stacks', $data, 60 );
} else {
} elseif ( wp_using_ext_object_cache() ) {
return wp_cache_set( '_hm_all_stacks', $data, null, 60 );
} else {
return set_transient( '_hm_all_stacks', $data, 60 );
}
}

Expand Down