com.twitter.storehaus.mysql

MySqlStore

class MySqlStore extends Store[MySqlValue, MySqlValue]

Simple storehaus wrapper over finagle-mysql.

Assumes the underlying table's key and value columns are both strings. Supported MySQL column types are: BLOB, TEXT, VARCHAR.

The finagle-mysql client is required to set the user, database and create the underlying table schema prior to this class being used.

Storehaus-mysql also works with pre-populated MySQL tables, based on the assumption that the key column picked is unique. Any table columns other than the picked key and value columns are ignored during reads and writes.

Example usage:

import com.twitter.finagle.exp.mysql.Client
import com.twitter.storehaus.mysql.MySqlStore

val client = Client("localhost:3306", "storehaususer", "test1234", "storehaus_test")
val schema = """CREATE TABLE `storehaus-mysql-test` (
      `key` varchar(40) DEFAULT NULL,
      `value` varchar(100) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"""
// or, use an existing pre-populated table.
client.query(schema).get
val store = MySqlStore(client, "storehaus-mysql-test", "key", "value")
Source
MySQLStore.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. MySqlStore
  2. Store
  3. ReadableStore
  4. Closeable
  5. AnyRef
  6. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MySqlStore(client: Client, table: String, kCol: String, vCol: String)

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val DELETE_SQL: String

  7. val INSERT_SQL: String

  8. val MULTI_SELECT_SQL_PREFIX: String

  9. val SELECT_SQL: String

  10. val UPDATE_SQL: String

  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  13. def close(): Unit

    Close this store and release any resources.

    Close this store and release any resources. It is undefined what happens on get/multiGet after close

    Definition Classes
    MySqlStoreReadableStore → Closeable
  14. val deleteStmt: PreparedStatement

  15. def doDelete(k: MySqlValue): Future[Result]

    Attributes
    protected
  16. def doSet(k: MySqlValue, v: MySqlValue): Future[Result]

    Attributes
    protected
  17. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  20. def g(s: String): String

    Attributes
    protected
  21. def get(k: MySqlValue): Future[Option[MySqlValue]]

    get a single key from the store.

    get a single key from the store. Prefer multiGet if you are getting more than one key at a time

    Definition Classes
    MySqlStoreReadableStore
  22. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  24. val insertStmt: PreparedStatement

  25. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  26. def multiGet[K1 <: MySqlValue](ks: Set[K1]): Map[K1, Future[Option[MySqlValue]]]

    Get a set of keys from the store.

    Get a set of keys from the store. Important: all keys in the input set are in the resulting map. If the store fails to return a value for a given key, that should be represented by a Future.exception.

    Definition Classes
    MySqlStoreReadableStore
  27. def multiPut[K1 <: MySqlValue](kvs: Map[K1, Option[MySqlValue]]): Map[K1, Future[Unit]]

    Replace a set of keys at one time

    Replace a set of keys at one time

    Definition Classes
    Store
  28. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  31. def put(kv: (MySqlValue, Option[MySqlValue])): Future[Unit]

    replace a value Delete is the same as put((k,None))

    replace a value Delete is the same as put((k,None))

    Definition Classes
    MySqlStoreStore
  32. val selectStmt: PreparedStatement

  33. def set(k: MySqlValue, v: MySqlValue): Future[Result]

    Attributes
    protected
  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  35. def toString(): String

    Definition Classes
    AnyRef → Any
  36. val updateStmt: PreparedStatement

  37. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  38. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  39. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Store[MySqlValue, MySqlValue]

Inherited from Closeable

Inherited from AnyRef

Inherited from Any