logging in or signing up Basic File Cache Tutorial - PHP ProdigyView Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 21 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: December 14, 2011 This Presentation is Public Favorites: 0 Presentation Description Learn the basics of writing, reading and checking expiration of file cache. Comments Posting comment... Premium member Presentation Transcript Basic File Caching: Basic File CachingOverview: Overview Objective Learn the basics of caching data in ProdigyView to help speed up your server’s performance. Requirements Basic Understanding of Cache Estimated Time 12 MinutesFollow Along With Code Example: Follow Along With Code Example Download a copy of the example code at www.prodigyview.com/source . Install the system in an environment you feel comfortable testing in. Proceed to examples/system/ Cache.phpCreate Cache: Create Cache Writing a file to cache is relatively simple. All you need is a key/name and content to put in the cache. 1. Initialize the cache object 2. Set the key/name 3. Write content to cacheAdding Options: Adding Options Cache uses the default values that can be set in PVCache :: init () . To override those default values, we can pass in our own options. Modify Cache Expiration and the name of the cache Set the expiration time in secondsReading The Cache: Reading The Cache With cache that is stored, we need a way of reading it. They key/name used to save the cache will also be used for reading it.The Cache Tag: The Cache Tag By default, the tag used to identify the cache is removed, If you want to read the cache tag, pass the options in not to remove the tag. Set the option keeping the cache tag Remember to set the cache name if not using the defaultCache Tag Results: Cache Tag Results Cache Tag Cache Tag With Explicitly Set NameChecking Expiration: Checking Expiration Oh, so that is the tag used for setting the expiration. Wait, how do you check the expiration? Simply pass the key/name of the file to check. Check if the cache has expired by the key Check name and keyExpiration Date: Expiration Date If you need to pull the expiration date from the file, PVCache :: getExpiration () method will pull the date for you in a string format. Get the expiration in a date format Add the option to use a name for the cacheExpiration Date Result: Expiration Date Result Expiration date/time formatDelete Cache: Delete Cache The final step to manipulating the cache is to delete the cache. After it is deleted, accessing cache through that key will return a null.Objects And Array: Objects And Array One of the coolest features about the cache in ProdigyView is the ability to store objects and arrays into cache. These data structures will be serialized on entry and unserialized on retrieval. Set the cache key/name Pass array into cache Read the cache as normal and print out keyHow to use cache: How to use cache We know how to read, write, check and delete cache, but we actually use it? Simple, check then read or write. 1. Check if the cache has expired first 2. If is not expired, return the cache 3. If it has expired, query that database to find your content. 4. Write the content to cache and return itChallenge!: Challenge! This is an optional challenge to improve you understanding of cache. Create a page with header , body and footer content in a string. Write the header content to cache and set to expire in 3 minutes. Write the body content to cache and set to expire in 5 minutes. Write the footer content to cache and set to expire in 7 minutes . Add new content to each section of the page only after the content has expired.API Reference: API Reference For a better understanding of cache in ProdigyView , visit the api by clicking on the link below. PVCache www.prodigyview.com More Tutorials For more tutorials, please visit: http:// www.prodigyview.com /tutorials You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
Basic File Cache Tutorial - PHP ProdigyView Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 21 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: December 14, 2011 This Presentation is Public Favorites: 0 Presentation Description Learn the basics of writing, reading and checking expiration of file cache. Comments Posting comment... Premium member Presentation Transcript Basic File Caching: Basic File CachingOverview: Overview Objective Learn the basics of caching data in ProdigyView to help speed up your server’s performance. Requirements Basic Understanding of Cache Estimated Time 12 MinutesFollow Along With Code Example: Follow Along With Code Example Download a copy of the example code at www.prodigyview.com/source . Install the system in an environment you feel comfortable testing in. Proceed to examples/system/ Cache.phpCreate Cache: Create Cache Writing a file to cache is relatively simple. All you need is a key/name and content to put in the cache. 1. Initialize the cache object 2. Set the key/name 3. Write content to cacheAdding Options: Adding Options Cache uses the default values that can be set in PVCache :: init () . To override those default values, we can pass in our own options. Modify Cache Expiration and the name of the cache Set the expiration time in secondsReading The Cache: Reading The Cache With cache that is stored, we need a way of reading it. They key/name used to save the cache will also be used for reading it.The Cache Tag: The Cache Tag By default, the tag used to identify the cache is removed, If you want to read the cache tag, pass the options in not to remove the tag. Set the option keeping the cache tag Remember to set the cache name if not using the defaultCache Tag Results: Cache Tag Results Cache Tag Cache Tag With Explicitly Set NameChecking Expiration: Checking Expiration Oh, so that is the tag used for setting the expiration. Wait, how do you check the expiration? Simply pass the key/name of the file to check. Check if the cache has expired by the key Check name and keyExpiration Date: Expiration Date If you need to pull the expiration date from the file, PVCache :: getExpiration () method will pull the date for you in a string format. Get the expiration in a date format Add the option to use a name for the cacheExpiration Date Result: Expiration Date Result Expiration date/time formatDelete Cache: Delete Cache The final step to manipulating the cache is to delete the cache. After it is deleted, accessing cache through that key will return a null.Objects And Array: Objects And Array One of the coolest features about the cache in ProdigyView is the ability to store objects and arrays into cache. These data structures will be serialized on entry and unserialized on retrieval. Set the cache key/name Pass array into cache Read the cache as normal and print out keyHow to use cache: How to use cache We know how to read, write, check and delete cache, but we actually use it? Simple, check then read or write. 1. Check if the cache has expired first 2. If is not expired, return the cache 3. If it has expired, query that database to find your content. 4. Write the content to cache and return itChallenge!: Challenge! This is an optional challenge to improve you understanding of cache. Create a page with header , body and footer content in a string. Write the header content to cache and set to expire in 3 minutes. Write the body content to cache and set to expire in 5 minutes. Write the footer content to cache and set to expire in 7 minutes . Add new content to each section of the page only after the content has expired.API Reference: API Reference For a better understanding of cache in ProdigyView , visit the api by clicking on the link below. PVCache www.prodigyview.com More Tutorials For more tutorials, please visit: http:// www.prodigyview.com /tutorials