| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | = Controller API = |
| | 4 | |
| | 5 | A Controller in a Model-Glue application extends the !ModelGlue.Core.Controller CFC. |
| | 6 | |
| | 7 | The base controller contains a set of functions known as the Controller API. These functions are available inside all controllers and provide controller-related functionality. |
| | 8 | |
| | 9 | == Adding a Message Listener Function == |
| | 10 | |
| | 11 | To add a function that can be registered via a <message-listener> tag, the function must have a RETURNTYPE attribute of VOID, and a single argument of type "any". |
| | 12 | |
| | 13 | == !AddToCache(name:string, value:any, [timeout:numeric]) == |
| | 14 | |
| | 15 | ==== Description ==== |
| | 16 | |
| | 17 | Adds the value passed to the controllers internal cache, using the name passed as a key. If timeout is passed, it is the lifespan, in minutes, of the value passed. |
| | 18 | |
| | 19 | ==== Returns ==== |
| | 20 | |
| | 21 | Void |
| | 22 | |
| | 23 | ==== Arguments ==== |
| | 24 | |
| | 25 | Name (Required) - The key by which to identify this value in the cache. |
| | 26 | |
| | 27 | Value (Required) - The value to cache |
| | 28 | |
| | 29 | Timeout (Optional) - The number of minutes to store the value in the cache. Defaults to the !DefaultCacheTimeout setting set the !ModelGlueConfiguration bean in !ColdSpring.xml. |
| | 30 | |
| | 31 | == !GetFromCache(name:string) == |
| | 32 | |
| | 33 | ==== Description ==== |
| | 34 | |
| | 35 | Gets a value from the cache with a matching name. If the value does not exist, an error of type !ModelGlue.Util.!TimedCache.!ItemNotFound will be thrown. |
| | 36 | |
| | 37 | ==== Returns ==== |
| | 38 | |
| | 39 | Any |
| | 40 | |
| | 41 | ==== Arguments ==== |
| | 42 | |
| | 43 | Name (Required) - The key of the value to retrieve. |
| | 44 | |
| | 45 | == !GetModelGlue() == |
| | 46 | |
| | 47 | ==== Description ==== |
| | 48 | |
| | 49 | Returns the Model-Glue framework itself |
| | 50 | |
| | 51 | ==== Returns ==== |
| | 52 | |
| | 53 | !ModelGlue.unity.framework.!ModelGlue |
| | 54 | |
| | 55 | ==== Arguments ==== |
| | 56 | |
| | 57 | None |