Changes between Version 1 and Version 2 of HowTos/HowToUseContentCaching
- Timestamp:
- 02/14/10 05:59:23 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
HowTos/HowToUseContentCaching
v1 v2 48 48 The cacheTimeout argument sets how long the cached event-handler or included view remains in the cache. By default this is 5 seconds. You can override this value using the defaultCacheTimeout as documented earlier in this document. Or, you can use the cacheTimeout argument on an event-handler or include tag to control how long this item is cached. 49 49 50 == The Beans Scope and the !CacheAdapt or ==50 == The Beans Scope and the !CacheAdapter == 51 51 52 Model-Glue uses a component known as a !CacheAdapt or to cache data. The !CacheAdaptor is placed in the beans scope for all Controllers and is easily accessible there. As an example, to dump this object you could ad this code within a controller:52 Model-Glue uses a component known as a !CacheAdapter to cache data. The !CacheAdapter is placed in the beans scope for all Controllers and is easily accessible there. As an example, to dump this object you could ad this code within a controller: 53 53 {{{ 54 <cfdump var="#beans.CacheAdapt or#" />54 <cfdump var="#beans.CacheAdapter#" /> 55 55 }}} 56 This object provides functions you can use to interact with the !CacheAdapt or. You can, for example, purge the cache, add values, etc. In fact, the legacy !AddToCache, !ExistsInCache, !GetFromCache, and !RemoveFromCache functions on the controller simply access the beans-scoped !CacheAdaptor.56 This object provides functions you can use to interact with the !CacheAdapter. You can, for example, purge the cache, add values, etc. In fact, the legacy !AddToCache, !ExistsInCache, !GetFromCache, and !RemoveFromCache functions on the controller simply access the beans-scoped !CacheAdapter. 57 57 58 For complete details on the functions on the !CacheAdapt or see the API documentation.58 For complete details on the functions on the !CacheAdapter see the API documentation. 59 59 == Creating Custom Caching Systems == 60 60 61 61 Model-Glue's built in caching system is intentionally simple. It simply puts items into a component in the application scope. If you need something more complex you can implement your own caching system. 62 62 63 By creating your own !CacheAdapt or you could, for example, make use of Memcached or JDBM for an enterprise class caching system.63 By creating your own !CacheAdapter you could, for example, make use of Memcached or JDBM for an enterprise class caching system. 64 64 65 To do this, you will need to create your own !CacheAdapt or by either extending the65 To do this, you will need to create your own !CacheAdapter by either extending the 66 66 !ModelGlue.gesture.externaladapters.contentcaching.!SimpleTimedCache or simply implement the !ModelGlue.gesture.externaladapters.contentcaching.!IContentCache interface. 67 67 68 Once you've created your cache adapt or you simply need to write it in. To do so you will need to add a !ColdSpring bean in your !ColdSpring configuration file with an ID of "modelglue.cacheAdapter". Here's a basic example:68 Once you've created your cache adapter you simply need to write it in. To do so you will need to add a !ColdSpring bean in your !ColdSpring configuration file with an ID of "modelglue.cacheAdapter". Here's a basic example: 69 69 {{{ 70 <bean id="modelGlue.cacheAdapter" class="Model.cache.ExampleCacheAdapt or">70 <bean id="modelGlue.cacheAdapter" class="Model.cache.ExampleCacheAdapter"> 71 71 <!-- my configuration properties would go here --> 72 72 </bean> 73 73 }}} 74 When you restart your Model-Glue application it will start using your new, custom, !CacheAdapt or.74 When you restart your Model-Glue application it will start using your new, custom, !CacheAdapter.
![(please configure the [header_logo] section in trac.ini)](/ModelGlue.com/trac.cgi/chrome/site/your_project_logo.png)