File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/main/java/org/sharrissf/sample Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,14 @@ private void initializeCache() {
44
44
// Create attributes on the stuff we want to be able to search on.
45
45
46
46
// You can use an expression for getting at the value to be indexed on a cache or you can code your own
47
+
48
+ // Expression
47
49
SearchAttribute sa = new SearchAttribute ();
48
50
sa .setExpression ("value.getAge()" );
49
51
sa .setName ("age" );
50
52
cacheConfig .addSearchAttribute (sa );
51
53
54
+ // Coding your own
52
55
sa = new SearchAttribute ();
53
56
sa .className ("org.sharrissf.sample.EhcacheSearchPlaying$NameAttributeExtractor" );
54
57
sa .setName ("name" );
@@ -64,6 +67,16 @@ private void initializeCache() {
64
67
sa .setName ("state" );
65
68
cacheConfig .addSearchAttribute (sa );
66
69
70
+ // If you want to initialize it via ehcache.xml it would look like this
71
+ // <cache name="test" maxElementsInMemory="0" eternal="true" overflowToDisk="false">
72
+ // <searchAttribute name="age" expression="value.getAge()"/>
73
+ // <searchAttribute name="name" class="org.sharrissf.sample.EhcacheSearchPlaying$NameAttributeExtractor"/>
74
+ // <searchAttribute name="gender" expression="value.getGender()"/>
75
+ // <searchAttribute name="state" expression="value.getState()"/>
76
+ // </cache>
77
+
78
+
79
+
67
80
cacheManagerConfig .addCache (cacheConfig );
68
81
69
82
cacheManager = new CacheManager (cacheManagerConfig );
You can’t perform that action at this time.
0 commit comments