@Override public Object desanitizeKey(Object sanitzedCacheKey) throws KeySanitationExcepion { if (!(sanitzedCacheKey instanceof String)) { throw new KeySanitationExcepion(DefaultKeySanitizer.class.getSimpleName() + " can only be used with Strings cache keys."); } try { return new String(Base64.decode((String) sanitzedCacheKey, BASE64_FLAGS), UTF8_CHARSET_NAME); } catch (UnsupportedEncodingException e) { throw new KeySanitationExcepion(e); } } }
@Override public Object sanitizeKey(Object cacheKey) throws KeySanitationExcepion { if (!(cacheKey instanceof String)) { throw new KeySanitationExcepion(DefaultKeySanitizer.class.getSimpleName() + " can only be used with Strings cache keys."); } try { return Base64.encodeToString(((String) cacheKey).getBytes(UTF8_CHARSET_NAME), BASE64_FLAGS); } catch (UnsupportedEncodingException e) { throw new KeySanitationExcepion(e); } }