case class ReplaceAndTruncateSanitizer(replacementChar: String = "_", maxKeyLength: Int = 250) extends MemcachedKeySanitizer with Product with Serializable
Sanitizer that replaces characters invalid for Memcached and truncates keys if they are over a certain limit.
Convenient because it creates human-readable keys, but only safe for ASCII chars.
- replacementChar
optional, defaults to an underscore
- maxKeyLength
optional, defaults to 250, which is the max length of a Memcached key
- Alphabetic
- By Inheritance
- ReplaceAndTruncateSanitizer
- Serializable
- Serializable
- Product
- Equals
- MemcachedKeySanitizer
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
ReplaceAndTruncateSanitizer(replacementChar: String = "_", maxKeyLength: Int = 250)
- replacementChar
optional, defaults to an underscore
- maxKeyLength
optional, defaults to 250, which is the max length of a Memcached key
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val invalidCharsRegex: Regex
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val maxKeyLength: Int
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val replacementChar: String
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toValidMemcachedKey(key: String): String
Convert the given string to a valid Memcached key by:
Convert the given string to a valid Memcached key by:
- replacing all invalid characters with underscores
- truncating the string to 250 characters
From the Memcached protocol spec:
Data stored by memcached is identified with the help of a key. A key is a text string which should uniquely identify the data for clients that are interested in storing and retrieving it. Currently the length limit of a key is set at 250 characters (of course, normally clients wouldn't need to use such long keys); the key must not include control characters or whitespace.
Because of the structure of cache keys, the most useful information is likely to be at the right hand end, so truncation is performed from the left.
- Definition Classes
- ReplaceAndTruncateSanitizer → MemcachedKeySanitizer
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )