--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.
To post to this group, send email to simple-spring-memecached@googlegroups.com.
Visit this group at https://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/d/optout.
private <T> void set(String cacheKey, int expiration, T value, SerializationType serializationType, CacheTranscoder cacheTranscoder) throws TimeoutException, CacheException {
if (SerializationType.PROVIDER.equals(serializationType)) {
this.cacheClient.set(cacheKey, expiration, value);
} else if (cacheTranscoder == null) {
throw new IllegalArgumentException(String.format("Cannot use %s serialization because dedicated cache transcoder is null!", serializationType));
} else {
this.cacheClient.set(cacheKey, expiration, value, cacheTranscoder);
}
}
Can you please let me know if i'm missing something here?
Hi,Have you set CacheFactory.properties.useNameAsKeyPrefix to true? It should prefix each of the key with a cache's name.Best regards,Ragnor
On 5 June 2018 at 11:10, Sweta Nahata <naha...@gmail.com> wrote:
Hi,I am using simple spring memcached with spymemcached provider (version 3.3.0) and have defined a number of caches, some of which use the same cache key.Cache1:cacheKey -> Value1Cache2:cacheKey -> Value2Since cacheKey is in different caches putting the cacheKey in one cache should not override the one in other cache. However, that is not the case.This causes ClassCastException when Value1 and Value2 are of different types.I read in other posts that this issue is resolved in version 3.3.0 of simple-spring-memcached, however i am still observing this issue.Can you please let me know if this is the expected behaviour?Thanks,Sweta
--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsubscr...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
Visit this group at https://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.
To post to this group, send email to simple-spring-memecached@googlegroups.com.
<bean class="com.google.code.ssm.spring.SSMCacheManager" id="cacheManager">
<property name="caches">
<set>
<bean class="com.google.code.ssm.spring.SSMCache">
<constructor-arg index="0" name="cache" ref="defaultCache"></constructor-arg>
<constructor-arg index="1" name="expiration" value="1"></constructor-arg>
<constructor-arg index="2" name="allowClear" value="false"></constructor-arg>
</bean>
<bean class="com.google.code.ssm.spring.SSMCache"><constructor-arg index="0" name="cache" ref="openjpa-querycache"></constructor-arg></set>
<constructor-arg index="1" name="expiration" value="5"></constructor-arg>
<constructor-arg index="2" name="allowClear" value="false"></constructor-arg>
</bean>
</property>
</bean>
<bean class="com.google.code.ssm.CacheFactory" id="openjpa-querycache" parent="defaultCache">
<property name="cacheName" value="openjpa-querycache">
</property>
</bean>
<bean class="com.google.code.ssm.CacheFactory" id="defaultCache">
<property name="cacheName" value="defaultCache"/>
<property name="cacheClientFactory">
<bean class="com.google.code.ssm.providers.spymemcached.MemcacheClientFactoryImpl"></bean>
</property>
<property name="addressProvider">
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
<property name="address" value="localhost:11211">
</property></bean>
</property>
<property name="configuration">
<bean class="com.google.code.ssm.providers.CacheConfiguration">
<property name="consistentHashing" value="true">
</property>
<property name="useBinaryProtocol" value="true" />
<property name="useNameAsKeyPrefix" value="true" />
</bean>
</property>
</bean>
When I debugged the code the else part of the code is called in the below method of CacheFactory which creates an instance of CacheImpl.
protected Cache createCache() throws IOException {
if (this.cache != null) {
throw new IllegalStateException(String.format("This factory has already created memcached client for cache %s", this.cacheName));
} else if (this.isCacheDisabled()) {
LOGGER.warn("Cache {} is disabled", this.cacheName);
this.cache = (Cache)Proxy.newProxyInstance(Cache.class.getClassLoader(), new Class[]{Cache.class}, new DisabledCacheInvocationHandler(this.cacheName, this.cacheAliases));
return this.cache;
} else if (this.configuration == null) {
throw new RuntimeException(String.format("The MemcachedConnectionBean for cache %s must be defined!", this.cacheName));
} else {
List<InetSocketAddress> addrs = this.addressProvider.getAddresses();
this.cache = new CacheImpl(this.cacheName, this.cacheAliases, this.createClient(addrs), this.defaultSerializationType, this.jsonTranscoder, this.javaTranscoder, this.customTranscoder, new CacheProperties(this.configuration.isUseNameAsKeyPrefix(), this.configuration.getKeyPrefixSeparator()));
return this.cache;
}
}
Can you please let me know if i'm missing something here?Thanks,Sweta
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
Visit this group at https://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.
<bean class="com.google.code.ssm.spring.SSMCacheManager" id="cacheManager">
<property name="caches">
<set>
<bean class="com.google.code.ssm.spring.SSMCache">
<constructor-arg index="0" name="cache">
<bean class="com.google.code.ssm.PrefixedCacheImpl">
<constructor-arg index="0" name="cache" ref="defaultCache"/>
<constructor-arg index="1" name="requestedName" value="defaultCache"/>
<constructor-arg index="2" name="namePrefixSeparator" value="#"/>
</bean>
</constructor-arg>
<constructor-arg index="1" name="expiration" value="1"/>
<constructor-arg index="2" name="allowClear" value="false"/>
</bean>
<bean class="com.google.code.ssm.spring.SSMCache">
<constructor-arg index="0" name="cache">
<bean class="com.google.code.ssm.PrefixedCacheImpl">
<constructor-arg index="0" name="cache" ref="openjpa-querycache"/>
<constructor-arg index="1" name="requestedName" value="openjpa-querycache"/>
<constructor-arg index="2" name="namePrefixSeparator" value="#"/>
</bean>
</constructor-arg>
<constructor-arg index="1" name="expiration" value="5"/>
<constructor-arg index="2" name="allowClear" value="false"/>
</bean>
</set>
</property>
</bean>
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsubscr...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
Visit this group at https://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsubscr...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
Visit this group at https://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.
To post to this group, send email to simple-spring-memecached@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
Visit this group at https://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
Visit this group at https://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-memecached+unsub...@googlegroups.com.