It looks you’re using different transient names in get_ and set_.
Try the following:
$transient_key = 'apidata_json_cache';
$expiration = 2*60; // 2 Minutes
if( false === ( $feed = get_transient( $transient_key ) ) ) {
echo '<!--Fresh data-->';
/*data extraction process here, which is than stored in $feed*/
set_transient( $transient_key, $feed, $expiration );
}
Related Posts:
- When should I be using the Transients API?
- Cache remote (HTTP) request with Transients API
- Is there any danger in deleting all transients?
- Why are transients cleared prematurely?
- Get a list of existing transients
- Storing posts social counters by using transient api
- How to save new transients if query changes?
- Integrating WP-TLC-Transients with WordPress – Where to Begin?
- Is priming a Transient Cache possible?
- What causes a transient to changes status to “Does Not Expire”?
- Reset Transient on New Day
- How to use transients and variables
- Transient storage location? database/xcache/w3Total Cache?
- How to delete transients written by fetch_feed()?
- Set Transient expiration
- WordPress transient doesn’t use the transient
- How do I reset a transient when updating a widget’s value?
- How to clear Transients on all sites in Multi Sites environment
- Is this the proper usage of creating / using a transient?
- Should I use the Transients API to temporarily hold edited attachements?
- transient or not transient
- Can Transients be used to store sensitive data?
- wp_options flooded with transient API entires
- Why Transients may not work correctly?
- How many transients is too many transients
- Synchronize Data every minute with set_transient
- Difference between get_site_transient() and get_transient()
- delete_transient on click inside a widget form
- Set_Transient to end at midnight
- Whats wrong with this transient? Not caching as expected
- Set transient with get posts error
- Clear Transients
- Unique Transients user id for Non-Logged In users
- Transient is never set. Why?
- Button to clear transients
- Hacked site using transient API?
- Ajax call to transients
- Why can’t I save encrypted data in a transient?
- Doesn’t set_transient() add multiple rows with the same key?
- Are transients garbage collected?
- Will it break my site if I delete all transient records in wp_options table?
- Is get_option() faster than accessing get_transient()?
- wp-cron.php – How are WP’s Cron transients removed?
- Using a wildcard with delete_transient()
- Does set_transient() overwrite/update transient option with same key?
- What’s the case against transient-ing almost everything that’s mostly static?
- How to delete cached transients from a widget instance properly?
- Should I store external API data in my WP database or keep it as a transient?
- How to purge all transient caches?
- Long option names fail silently?
- Use Transient API to cache queries for all posts in all categories?
- How to make sure that only one wp_cron() runs at a time?
- WP_Cron doesn’t do the job: Multisite stats
- WP_Query Performance Issues with meta_query
- wp_transients | wp_object_cache VS SESSIONS & Cookies?
- Transients API and multisite
- What to use , set_transient, set_option or file system? [closed]
- Must I serialize/sanitize/escape array data before using set_transient?
- How to purge all transient caches?
- Transient API and caching Plugins
- How to cache posts based on $_GET? Option name is too long? Options / transients
- WordPress Caching – Transients API or “update_user_meta ” Cronjob?
- Messing up with transient API – getting flushed on refresh
- Any insights into Transient API locking, cron and threading?
- how to build (custom) stats for post views, per month
- Transient unique names
- Force Plugin Updates: “Update Failed: Plugin update failed.” after update one plugin
- Store sticky post’s ids in a transient
- Storing product price data in the database
- Transient feeds and caching error
- Transient loop issue
- Delete transients in website
- is_wp_error() and handling errors
- How to store or cache custom shopping cart data for every user’s session
- Hook an action when a transient is deleted ? Can’t get it to work!
- Transients API conditional
- Transient api Caches confused
- What is the best practice to set and update Transient value of API data in every minute?
- Using transient for dynamic css , how to name it?
- Reset all transients on post or page save
- What is the best way (regarding performance) to set transients for logged in users?
- Set WordPress Transient Expiration via Variable Value
- Using Transients
- Updating transient value frequently
- Search transients through widget
- Custom Plugin Options Won’t Update
- Is there a better way to access transients using javascript
- Using `set_transient()` when saving a custom post type
- Check the stored / cached WP_Query with transients on post change
- wp_trash_post() duplicates post to trash
- Set user status to absent on WordPress
- Hi , i am trying to set the post for 24 hours and with it will be changed
- How to use a transient inside WP_User_Query
- Delete Transient when clicking ‘Save Changes’ on options page
- Show the online status of the current post’s author
- How to optimize performance without transient?
- how to use transient method?
- How get JSON from external API on every page load if not existing in transient?
- How to create a transient that persists the data for the whole duration of the expiration, even when object cache is enabled?
- How to cache wordpress get_posts query using transients?