Reputation: 5434
My PHP application needs to support Ajax calls from web browsers that provide a controller function with a search string. That search string is searched against an in-memory "array" of names + IDs. When a name is found, the NAME + ID is added to the return result for the AJAX call.
Initially that Name + ID resides in a database.
I am looking for best practices where every instance of PHP server loads up the list from the database, lazily, once, on the first call and conducts the sub-string search in memory for all subsequent searches.
IS memcached good for this? I know it's an in-memory key-value repository, but can it handle the sub-string search? Is there another best-practice I can use for this?
Upvotes: 1
Views: 192
Reputation: 116
Memcached doesn't have such functionality, it only allows to access value by known key. Value is transparent for the memcached.
To effectively match sub-string it is better to look at the storage engines that support secondary indexes such as tarantool
If expected size of the value is not too big, maybe naive PHP function would be suffucient.
Upvotes: 1