diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,10 @@
 # Revision history for selda
 
+## 0.1.4.1 -- 2017-05-04
+
+* Fix cache consistency bug in the presence of multiple databases.
+
+
 ## 0.1.4.0 -- 2017-05-04
 
 * Add uniqueness constraints and foreign keys.
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -19,12 +19,12 @@
 
 * Monadic interface: no need to be a category theory wizard just to write a few
   database queries.
-* Portable: fully functional backends for SQLite and PostgreSQL.
+* Portable: backends for SQLite and PostgreSQL.
 * Generic: easy integration with your existing Haskell types.
 * Creating, dropping and querying tables using type-safe database schemas.
 * Typed query language with products, filtering, joins and aggregation.
 * Inserting, updating and deleting rows from tables.
-* Transaction support.
+* Transactions, uniqueness constraints and foreign keys.
 * Configurable, automatic, consistent in-process caching of query results.
 * Lightweight and modular: non-essential features are optional or split into
   add-on packages.
@@ -566,7 +566,7 @@
 in-process caching.
 It is perfectly fine, however, to have multiple *threads* within the same
 application modifying the same database as long as they're all using Selda
-to do it, as the cache shared between all Selda computations
+to do it, as the cache is shared between all Selda computations
 running in the same process.
 
 
diff --git a/selda.cabal b/selda.cabal
--- a/selda.cabal
+++ b/selda.cabal
@@ -1,5 +1,5 @@
 name:                selda
-version:             0.1.4.0
+version:             0.1.4.1
 synopsis:            Type-safe, high-level EDSL for interacting with relational databases.
 description:         This package provides an EDSL for writing portable, type-safe, high-level
                      database code. Its feature set includes querying and modifying databases,
diff --git a/src/Database/Selda/Backend.hs b/src/Database/Selda/Backend.hs
--- a/src/Database/Selda/Backend.hs
+++ b/src/Database/Selda/Backend.hs
@@ -51,6 +51,11 @@
     -- | The keyword that represents the default value for auto-incrementing
     --   primary keys.
   , defaultKeyword :: Text
+
+    -- | A string uniquely identifying the database used by this invocation
+    --   of the backend. This could be, for instance, a PostgreSQL connection
+    --   string or the absolute path to an SQLite file.
+  , dbIdentifier   :: Text
 }
 
 data SeldaState = SeldaState
diff --git a/src/Database/Selda/Caching.hs b/src/Database/Selda/Caching.hs
--- a/src/Database/Selda/Caching.hs
+++ b/src/Database/Selda/Caching.hs
@@ -20,7 +20,7 @@
 import Database.Selda.SQL (Param (..))
 import Database.Selda.Types (TableName)
 
-type CacheKey = (Text, [Param])
+type CacheKey = (Text, Text, [Param])
 
 #ifdef NO_LOCALCACHE
 
diff --git a/src/Database/Selda/Frontend.hs b/src/Database/Selda/Frontend.hs
--- a/src/Database/Selda/Frontend.hs
+++ b/src/Database/Selda/Frontend.hs
@@ -152,7 +152,8 @@
 
 -- | Set the maximum local cache size to @n@. A cache size of zero disables
 --   local cache altogether. Changing the cache size will also flush all
---   entries.
+--   entries. Note that the cache is shared among all Selda computations running
+--   within the same process.
 --
 --   By default, local caching is turned off.
 --
@@ -160,24 +161,26 @@
 --   database, ONLY under the assumption that no other process will modify it.
 --   Also note that the cache is shared between ALL Selda computations running
 --   within the same process.
-setLocalCache :: MonadSelda m => Int -> m ()
+setLocalCache :: MonadIO m => Int -> m ()
 setLocalCache = liftIO . setMaxItems
 
 -- | Build the final result from a list of result columns.
 queryWith :: forall s m a. (MonadSelda m, Result a)
           => QueryRunner (Int, [[SqlValue]]) -> Query s a -> m [Res a]
 queryWith qr q = do
-    mres <- liftIO $ cached qry
+    db <- dbIdentifier <$> seldaBackend
+    let cacheKey = (db, qs, ps)
+    mres <- liftIO $ cached cacheKey
     case mres of
       Just res -> do
         return res
       _        -> do
         res <- fmap snd . liftIO $ uncurry qr qry
         let res' = mkResults (Proxy :: Proxy a) res
-        liftIO $ cache tables qry res'
+        liftIO $ cache tables cacheKey res'
         return res'
   where
-    (tables, qry) = compileWithTables q
+    (tables, qry@(qs, ps)) = compileWithTables q
 
 -- | Generate the final result of a query from a list of untyped result rows.
 mkResults :: Result a => Proxy a -> [[SqlValue]] -> [Res a]
