-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding changes to the Caching mechanism to support any object type
- Loading branch information
1 parent
f650377
commit 914eb69
Showing
6 changed files
with
119 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
sdk/src/main/java/org/wso2/spring/security/abac/cache/Cache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.wso2.spring.security.abac.cache; | ||
|
||
/** | ||
* @author Randika Navagamuwa | ||
*/ | ||
public interface Cache<K, V> { | ||
|
||
V get(K key); | ||
|
||
V putIfAbsent(K key, V value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
sdk/src/main/java/org/wso2/spring/security/abac/cache/EhCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.wso2.spring.security.abac.cache; | ||
|
||
/** | ||
* @author Randika Navagamuwa | ||
*/ | ||
public class EhCache implements Cache { | ||
|
||
private org.ehcache.Cache cache; | ||
|
||
public EhCache(org.ehcache.Cache cache) { | ||
|
||
this.cache = cache; | ||
} | ||
|
||
public org.ehcache.Cache getCache() { | ||
|
||
return this.cache; | ||
} | ||
|
||
@Override | ||
public Object get(Object key) { | ||
|
||
return this.cache.get(key); | ||
} | ||
|
||
@Override | ||
public Object putIfAbsent(Object key, Object value) { | ||
|
||
return this.cache.putIfAbsent(key, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters