Vae Guide
- About Vae
- No Assumptions, No Hacking
- Separation of Content and Layout
- Web Professionals Required
- A Sampling of Vae Sites
- Designer Portal
- Content Management
- Getting Started with Structures
- Structures
- Simple Structures
- Superstructures
- Hybrid Structures
- Validations
- Structure Type Reference
- Collection
- Section
- External
- Text
- Text Area
- Rich Text Area
- Checkbox
- Color
- Date
- File
- Image
- Password
- Video
- Association (single)
- Association (multi)
- Tags
- Hosting Platform Deluxe
- Accessing Your Webspace
- PHP and MySQL
- Haml and Sass
- Generating PDFs
- Summary -- Processing by Extension
- Global PHP Includes
- Custom Error Pages
- Permalinks
- SEO: Search Engine Optimization
- Caching
- Vae Local Development Environment
- VaeML
- Validating Forms
- <v> shortcuts
- <v:form>
- <v:checkbox>
- <v:country_select>
- <v:date_select>
- <v:file_field>
- <v:hidden_field>
- <v:password_field>
- <v:radio>
- <v:select>
- <v:state_select>
- <v:text_area>
- <v:text_field>
- <v:a>
- <v:a_if>
- <v:asset>
- <v:captcha>
- <v:cdn>
- <v:collection>
- <v:create>
- <v:date_selection>
- <v:debug>
- <v:disqus>
- <v:divider>
- <v:else>
- <v:facebook_comments>
- <v:facebook_like>
- <v:file>
- <v:fileurl>
- <v:flash>
- <v:formmail>
- <v:fragment>
- <v:gravatar>
- <v:if>
- <v:if_paginate>
- <v:if_time>
- <v:img>
- <v:imurl>
- <v:nested_collection>
- <v:nested_divider>
- <v:newsletter>
- <v:nowidows>
- <v:option_select>
- <v:pagination>
- <v:pdf>
- <v:php>
- <v:repeat>
- <v:require_ssl>
- <v:rss>
- <v:section>
- <v:session_dump>
- <v:set_default>
- <v:site_seal>
- <v:store:add_to_cart>
- <v:store:address_delete>
- <v:store:address_select>
- <v:store:addresses>
- <v:store:cart>
- <v:store:cart:discount>
- <v:store:cart:items>
- <v:store:cart:shipping>
- <v:store:cart:subtotal>
- <v:store:cart:tax>
- <v:store:cart:total>
- <v:store:checkout>
- <v:store:credit_card>
- <v:store:credit_card_select>
- <v:store:currency>
- <v:store:currency_select>
- <v:store:discount>
- <v:store:forgot>
- <v:store:google_checkout>
- <v:store:if_bank_transfer>
- <v:store:if_check>
- <v:store:if_credit_card>
- <v:store:if_currency>
- <v:store:if_digital_downloads>
- <v:store:if_discount>
- <v:store:if_field_overridden>
- <v:store:if_logged_in>
- <v:store:if_money_order>
- <v:store:if_paypal>
- <v:store:if_paypal_express_checkout>
- <v:store:if_recent_order_bank_transfer>
- <v:store:if_recent_order_check>
- <v:store:if_recent_order_credit_card>
- <v:store:if_recent_order_digital>
- <v:store:if_recent_order_money_order>
- <v:store:if_recent_order_paypal>
- <v:store:if_recent_order_paypal_express_checkout>
- <v:store:if_shippable>
- <v:store:if_tax>
- <v:store:item:if_discount>
- <v:store:item:price>
- <v:store:login>
- <v:store:logout>
- <v:store:payment_methods_select>
- <v:store:paypal_checkout>
- <v:store:paypal_express_checkout>
- <v:store:previous_order>
- <v:store:previous_orders>
- <v:store:recent_order>
- <v:store:recent_order_items>
- <v:store:register>
- <v:store:shipping_method>
- <v:store:shipping_methods_select>
- <v:store:user>
- <v:text>
- <v:template>
- <v:update>
- <v:users:forgot>
- <v:users:if_logged_in>
- <v:users:login>
- <v:users:logout>
- <v:users:register>
- <v:video>
- <v:yield>
- <v:zip>
- VaeQL
- PHP API
- vae()
- vae_asset()
- vae_cache()
- vae_cdn_url()
- vae_create()
- vae_customer()
- vae_data_path()
- vae_data_url()
- vae_destroy()
- vae_disable_vaeml()
- vae_errors()
- vae_file()
- vae_flash()
- vae_image() and vae_sizedimage()
- vae_image_grey()
- vae_image_reflect()
- vae_imagesize()
- vae_loggedin()
- vae_multipart_mail()
- vae_permalink()
- vae_redirect()
- vae_register_hook()
- vae_register_tag()
- vae_render_tags()
- vae_richtext()
- vae_store_add_item_to_cart()
- vae_store_add_shipping_method()
- vae_store_cart_item()
- vae_store_cart_items()
- vae_store_checkout()
- vae_store_clear_discount_code()
- vae_store_create_coupon_code()
- vae_store_create_tax_rate()
- vae_store_current_user()
- vae_store_destroy_all_tax_rates()
- vae_store_destroy_coupon_code()
- vae_store_destroy_tax_rate()
- vae_store_discount_code()
- vae_store_find_coupon_code()
- vae_store_loggedin()
- vae_store_orders()
- vae_store_recent_order()
- vae_store_register()
- vae_store_remove_from_cart()
- vae_store_total_weight()
- vae_store_update_cart_item()
- vae_store_update_coupon_code()
- vae_store_update_order_status()
- vae_store_update_tax_rate()
- vae_style()
- vae_text()
- vae_tick()
- vae_update()
- vae_video()
- vae_watermark()
- eCommerce
- Creating the Structures for a Typical Store
- The Shopping Flow in VaeML
- Customizing Order Confirmation E-Mails
- Viewing Orders
- Accepting Real Money: Integrating an Internet Merchant Account
- Real-Time Shipping Calculations
- Integrating With a Third-Party for Order Fulfillment
- Collecting Sales Tax
- Store General Settings
- Analytics
- Tutorials and Examples
- Full Site Tutorial: Vae Records
- Full Site Tutorial: Erin Smith Photography
- Resizing Images
- Paginating A Collection
- A Contact Form
- Using XML to Send Data to Flash App
- Using AJAX
- Making An AJAX Photo Gallery
- Backstage
- Content Tab
- Store Tab
- Customers Tab
- Newsletter Tab
- Site Tab
- Users Tab
- Usage / Billing Tab
vae_cache()
Use the vae_cache()
function to cache the results of a PHP function in
memory for a specified period of time and automatically display the
cached version if it is available.
This useful for implementing anything on your site that may take some time to compute, for example, pulling a feed of tweets from Twitter.
Vae uses a separate cache bucket for every unique page and set of request parameters. The cache is automatically invalidated if the source code of the accessed page has changed or if any data is changed in the backend. This makes it safe to cache just about anything.
Usage
vae_cache($cache_key, $valid_for = 3600, $function = null, $global = false)
-
$cache_key
- Key for this set of cached data. -
$valid_for
- Number of seconds to keep the cached data valid. Defaults to one hour. -
$function
– PHP function to call to initialize the cache. By default, this is assumed to be the same as the$cache_key
. This function must return the value to be displayed and saved in the cache. -
$global
- Normally we will maintain a separate cache for each unique user (or, more accurately, each unique set of cookies and session data) on your site. Setting this flag totrue
will maintain a single global cache. Defaults tofalse
.
Returns
Return your data, either pulled from the cache, or obtained by calling your function, depending on whether a cached copy exists.