Index: trunk/extensions/SemanticForms/SemanticForms.php |
— | — | @@ -318,6 +318,18 @@ |
319 | 319 | # ## |
320 | 320 | $sfgCacheFormDefinitions = false; |
321 | 321 | |
| 322 | +/** |
| 323 | + * The cache type for storing form definitions. This cache is similar in |
| 324 | + * function to the parser cache. Is is used to store form data which is |
| 325 | + * expensive to regenerate, and benefits from having plenty of storage space. |
| 326 | + * |
| 327 | + * If this setting remains at null the setting for the $wgParserCacheType will |
| 328 | + * be used. |
| 329 | + * |
| 330 | + * For available types see $wgMainCacheType. |
| 331 | + */ |
| 332 | +$sfgFormCacheType = null; |
| 333 | + |
322 | 334 | # ## |
323 | 335 | # When modifying red links to potentially point to a form to edit that page, |
324 | 336 | # check only the properties pointing to that missing page from the page the |
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php |
— | — | @@ -849,7 +849,7 @@ |
850 | 850 | if ( $sfgCacheFormDefinitions && $form_id !== null ) { |
851 | 851 | |
852 | 852 | $cachekey = wfMemcKey('ext.SemanticForms.formdefinition', $form_id); |
853 | | - $cached_def = wfGetMainCache()->get( $cachekey ); |
| 853 | + $cached_def = self::getFormCache()->get( $cachekey ); |
854 | 854 | |
855 | 855 | // Cache hit? |
856 | 856 | if ( $cached_def !== false && $cached_def !== null ) { |
— | — | @@ -918,14 +918,22 @@ |
919 | 919 | |
920 | 920 | if ( $wikipage->getTitle()->getNamespace() == SF_NS_FORM ) { |
921 | 921 | |
922 | | - $id = $wikipage->getId(); |
923 | | - $key = wfMemcKey('ext.SemanticForms.formdefinition', $id); |
| 922 | + $key = wfMemcKey('ext.SemanticForms.formdefinition', $wikipage->getId() ); |
924 | 923 | |
925 | | - if ( wfGetMainCache()->delete($key) ) { |
| 924 | + if ( self::getFormCache()->delete($key) ) { |
926 | 925 | wfDebug( "Deleted cached formdefinition $key.\n" ); |
927 | 926 | } |
928 | 927 | } |
929 | 928 | |
930 | 929 | return true; |
931 | 930 | } |
| 931 | + |
| 932 | + /** |
| 933 | + * Get the cache object used by the form cache |
| 934 | + */ |
| 935 | + public static function getFormCache() { |
| 936 | + global $sfgFormCacheType, $wgParserCacheType; |
| 937 | + $ret = & wfGetCache( ( $sfgFormCacheType !== null ) ? $sfgFormCacheType : $wgParserCacheType ); |
| 938 | + return $ret; |
932 | 939 | } |
| 940 | +} |