Last modified: 2012-09-18 18:14:57 UTC
Created attachment 10695 [details] Allow cache to be used for "remote autocomplete" ## What For each "remote autocomplete" request, the database goes into full-search mode which causes various bottlenecks for the server and increases waiting time for users. ## Solution Introduce a switch ($sfgCacheAutocompleteValues) which allows to use standard caching mechanism for results that use the same property_name / substring combination. This can help to increase the response time for users using field definitions that uses "remote autocomplete" and decrease unnecessary database selects that are initiated by each single "remote autocomplete" request. This solution is for users who want to use "remote autocomplete" to be able to fetch all possible results while at the same time don't have to sacrifice performance for ached results. ## Implementation see patch The patch introduces two new globals * $sfgCacheAutocompleteValues = true/false; * $sfgCacheAutocompleteTimeOut = 60 * 60 * 6; (6h) * $sfgFormCacheType is used to determine the cache type and is shared with SForm cache. ## Invalidation of cache For a sophisticated update logic of added/obsolete property/values pairs one would have to use $wgHooks['SMWStore::updateDataBefore'] and $wgHooks['smwDeleteSemanticData'] to track and invalidate pairs but since that would take some more effort to implement sfgCacheAutocompleteTimeOut is used to ensure cache objects are invalidate after a set time out.
A "nice to have" would be to send JS (SemanticForms.js) a parameter that the current values came from cache where the JS set an additional css class that could be used for a different colouring of the dropdown (ul class="ui-autocomplete") to visual distinguish the list from database or cache generated content.
Comment on attachment 10695 [details] Allow cache to be used for "remote autocomplete" [Correcting MIME Type and setting patch flag]
MWJames - sorry for the long delay on this! I didn't want to look into it until SF 2.5 was released. And thanks for the patch. I just checked in a slightly modified version of your patch, here: https://gerrit.wikimedia.org/r/#/c/23769/ It included renaming $sfgCacheAutocompleteTimeOut to $sfgAutocompleteCacheTimeout. Please let me know what you think.
I confirmed the patch, so now it's in - marking this as "fixed".