persistent-2.14.6.3: Type-safe, multi-backend data serialization.
Safe HaskellNone
LanguageHaskell2010

Database.Persist.SqlBackend.StatementCache

Synopsis

Documentation

data StatementCache Source #

A statement cache used to lookup statements that have already been prepared for a given query.

Since: 2.13.3

mkCacheKeyFromQuery :: Text -> StatementCacheKey Source #

Construct a StatementCacheKey from a raw SQL query.

data MkStatementCache Source #

Configuration parameters for creating a custom statement cache

Since: 2.13.3

Constructors

MkStatementCache 

Fields

  • statementCacheLookup :: StatementCacheKey -> IO (Maybe Statement)

    Retrieve a statement from the cache, or return nothing if it is not found.

    Since: 2.13.3

  • statementCacheInsert :: StatementCacheKey -> Statement -> IO ()

    Put a new statement into the cache. An immediate lookup of the statement MUST return the inserted statement for the given cache key. Depending on the implementation, the statement cache MAY choose to evict other statements from the cache within this function.

    Since: 2.13.3

  • statementCacheClear :: IO ()

    Remove all statements from the cache. Implementations of this should be sure to call stmtFinalize on all statements removed from the cache.

    Since: 2.13.3

  • statementCacheSize :: IO Int

    Get the current size of the cache.

    Since: 2.13.3

mkSimpleStatementCache :: IORef (Map Text Statement) -> MkStatementCache Source #

Make a simple statement cache that will cache statements if they are not currently cached.

Since: 2.13.3

mkStatementCache :: MkStatementCache -> StatementCache Source #

Create a statement cache.

Since: 2.13.0