So for example:
Foo : Bar
Could also be looked up as FOO, foo, fOO etc?
To list the keys in the Redis data store, use the KEYS command followed by a specific pattern. Redis will search the keys for all the keys matching the specified pattern. In our example, we can use an asterisk (*) to match all the keys in the data store to get all the keys.
Keys in Redis are all strings, so it doesn't really matter what kind of value you pass into a client.
Redis and PHPRedis EXISTS command is used to check whether the key exists in Redis or not.
The Redis KEYS command returns all the keys in the database that match a pattern (or all the keys in the key space). Similar commands for fetching all the fields stored in a hash is HGETALL and for all fetching the members of a SMEMBERS. The keys in Redis themselves are stored in a dictionary (aka a hash table).
No. You should lowercase/uppercase all your keys if you want that.
redis keys is case sensitive,my solution is that: key-->Foo:Bar keyword-->f
keys("[fF]*") or keyword-->foo
keys("[fF][oO][oO]*") you have to convert normal string to this format '[Ff][Oo]';
i write a method for this:
public static String toIgnoreCasePattern(String str){
StringBuilder sb = new StringBuilder();
char []chars = str.toCharArray();
char upperCaseC;
for(char c : chars){
boolean isLowerCase = Character.isLowerCase(c);
upperCaseC = isLowerCase ? Character.toUpperCase(c) : c;
sb.append("[").append(c).append(upperCaseC).append("]");
}
return sb.toString();
}
I hope this answer can help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With