atry / memcontinuationed Goto Github PK
View Code? Open in Web Editor NEWMemcached client for Scala
License: Apache License 2.0
Memcached client for Scala
License: Apache License 2.0
Value sizes are limited in the AsciiProtocol are limited to 32768
private final val MaxValueSize = 32768
However, by default values can be up to 1MB and with tuning values can be even larger. When the user attempts to write a larger value it works fine, but when they read that larger value they simply get a mysterious error such as:
SEVERE: com.dongxiguo.memcontinuationed.ProtocolException: Bad line VALUE raw:6TSa2041BHDwSWYtJA0+dmZvRNg= 0 168508
Hi,
If i send much conccurent requests to my application, I have an exception :
2013-08-08 17-40-19 C:\Users\atry\Documents\lalala\game\race-for-the-woolen\commons-continuations\src\main\scala\com\dongxiguo\commons\continuations\io\AsynchronousInputStream.scala:45 completed
SEVERE: Exception is thrown in continuation when handling a completed asynchronous reading. java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:492)
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:135)
I use linux system and not windows
It seems like authenticated MemCache isn't currently supported. It would be great to have this. Thanks!
I think the dependency part of the README can be simplified to:
libraryDependencies <++= scalaBinaryVersion {
case "2.10" =>
Seq()
case _ =>
Seq("org.scala-lang.plugins" %% "scala-continuations-library" % "1.0.1")
}
The binary protocol is proported to be faster, but memcontinuationed currently only uses the ASCII protocol.
I wish get key in memcache and if not found then add data in memcache and return data.
def getOrData[T](key: String, duration: Int = 10)(data: => T): Future[T] = {
reset {
memcached.get(Key(key)).get(Key(key)) match {
case None => {
memcached.add[Array[Byte]](Key%28key%29, Serialize.serialize%28data%29, Exptime.fromNowOn%28duration%29)
Future(data)
}
case Some(result) => {
Future(Serialize.unserializeT)
}
case _ =>
}
}
}
I don't have any problem with serialize and un unserialize method, this method take an Array of Byte and return T object.
But I have errors with my implementation :
scala.util.continuations.cpsParam[Unit,Unit] is not a subtype of scala.util.continuations.cpsParam[?,scala.concurrent.Future[T]]
[error] case None => {
illegal answer type modification: scala.util.continuations.cpsParam[Unit,Unit] andThen scala.util.continuations.cpsParam[?,scala.concurrent.Future[T]]
[error] memcached.get(Key(key)).get(Key(key)) match {
if I add addCompilerPlugin("org.scala-lang.plugins" % "continuations" % "2.10.2") in my build.scala, I have this error :
java.lang.NoClassDefFoundError: scala/reflect/internal/AnnotationCheckers$AnnotationChecker
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
...
Caused by: java.lang.ClassNotFoundException: scala.reflect.internal.AnnotationCheckers$AnnotationChecker
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
...
error java.lang.reflect.InvocationTargetException
But if I change the version of this plugin to 2.9.2, I don't have this error but I have some errors in my code because not found method require, add get etc (probably because scala 2.9.2)
Application has build with sbt 1.12.4 and scala 2.10.2
I'm trying to clone memcontinuationed and then run it in sbt. I get the following unresolved dependencies that prevent it from running:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.dongxiguo.zero-log#context_2.9.2;0.3.3: not found
[warn] :: com.dongxiguo#zero-log_2.9.2;0.3.3: not found
[warn] :: com.dongxiguo#commons-continuations_2.9.2;0.2.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
error sbt.ResolveException: unresolved dependency: com.dongxiguo.zero-log#context_2.9.2;0.3.3: not found
[error] unresolved dependency: com.dongxiguo#zero-log_2.9.2;0.3.3: not found
[error] unresolved dependency: com.dongxiguo#commons-continuations_2.9.2;0.2.1: not found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.