Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple hash-code based strategy #37

Open
abrucoli opened this issue May 23, 2014 · 2 comments
Open

Simple hash-code based strategy #37

abrucoli opened this issue May 23, 2014 · 2 comments
Assignees

Comments

@abrucoli
Copy link

The idea is avoid having @ParameterValueKeyProvider as mandatory in the caching mechanism but instead using the simple hash-code based strategy as default strategy to generate cache key.

This strategy computes the key based on the hashes of all parameters used for method invocation, because is based on the common assumption that different method parameters requires different cache key.

So for example with following method

@ReadThroughSingleCache(namespace = "fooNamesapce")
public List getCountries(String query, String orderField, String orderType, Integer page, Integer max) throws Exception

the cache key is generated starting from something like this

{namespace}{separator}{method qualified name}{separator}{parameter1Name}{separator}{paramter1hashcode}{separator}{parameter2name}{separator}{paramter2hashcode}....

Obviously if one/some of the parameters is null you just omit the parameter hascode.

@ragnor ragnor self-assigned this Jun 13, 2014
@ragnor ragnor added this to the v3.6.0 milestone Jun 13, 2014
@kwon37xi
Copy link

Could it be ok?
Memcached has 250 byte key limitation.
I think that this can make a problem without any notification.

@ragnor
Copy link
Owner

ragnor commented Mar 23, 2015

Good point @kwon37xi.
I'll keep it in mind, still there can be some error/warning if key is too long or a way to enable some hash mechanism for all keys or keys with length greater than 250 byte.

@ragnor ragnor modified the milestones: v3.7.0, v3.6.0 Jun 9, 2015
@ragnor ragnor removed this from the v4.0.0 milestone Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants