Soft launch of Transient Data

By Adam Patterson in: Announcements

Transient data is a principal borrowed from WordPress.

I have never directly used the Transient Data API but after reading the Docs saw a solid fit for Tentacle.

Transient data offers a simple and standardized way of storing cached data in the database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted.

In this example I am caching an RSS feed, I used CURL to get the XML and covered it to a string ( Because you can not serialize a SimpleXMLElement Object )


$cache->set( 'dashboard', $rss, '+30 minutes' );


$cache->get( 'dashboard' );

While the uses for Transient data are varied it will greatly benefit Plugin developers giving them the ability to store data such as API calls temporarily in the site without needing to use Cookies or Session variables.

In the above example of storing an RSS feed I saw an dramatic improvement in performance.

Before After
1.07374501228 0.00271201133728
1.19512701035 0.00225305557251
1.30446410179 0.00196194648743
1.13135004044 0.00199604034424
1.34088492393 0.00160908699036
1.20730185509 0.00171208381653
2.08574390411 0.00182604789734
1.21259403229 0.00170016288757
1.13693284988 0.00190711021423
1.58130979538 0.00200200080872
1.32694535255 0.00196795463562

As you can see the response time is much faster.

ALong with set() and get(), there is look_up(), and delete() soon clear() and flush().