Last modified: 2012-09-18 18:14:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39360, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37360 - [SF] 2.4.2; [patch] Enable cache in SFAutocompleteAPI
[SF] 2.4.2; [patch] Enable cache in SFAutocompleteAPI
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
master
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Yaron Koren
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-05 23:08 UTC by MWJames
Modified: 2012-09-18 18:14 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Allow cache to be used for "remote autocomplete" (1.70 KB, patch)
2012-06-05 23:08 UTC, MWJames
Details

Description MWJames 2012-06-05 23:08:44 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.
Comment 1 MWJames 2012-06-06 02:21:07 UTC
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 2 Andre Klapper 2012-09-12 15:50:27 UTC
Comment on attachment 10695 [details]
Allow cache to be used for "remote autocomplete"

[Correcting MIME Type and setting patch flag]
Comment 3 Yaron Koren 2012-09-13 22:57:53 UTC
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.
Comment 4 Yaron Koren 2012-09-18 18:14:57 UTC
I confirmed the patch, so now it's in - marking this as "fixed".

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links