Skip to content

Simple hash-code based strategy #37

@abrucoli

Description

@abrucoli

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.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions