Qualify cache table references
This commit is contained in:
parent
f3a7b9ea93
commit
ce30af17fe
|
@ -74,14 +74,14 @@ type DistributedCache () =
|
||||||
dataSource
|
dataSource
|
||||||
|> Sql.query $"
|
|> Sql.query $"
|
||||||
SELECT EXISTS
|
SELECT EXISTS
|
||||||
(SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = 'session')
|
(SELECT 1 FROM pg_tables WHERE schemaname = 'jjj' AND tablename = 'session')
|
||||||
AS does_exist"
|
AS does_exist"
|
||||||
|> Sql.executeRowAsync (fun row -> row.bool "does_exist")
|
|> Sql.executeRowAsync (fun row -> row.bool "does_exist")
|
||||||
if not exists then
|
if not exists then
|
||||||
let! _ =
|
let! _ =
|
||||||
dataSource
|
dataSource
|
||||||
|> Sql.query
|
|> Sql.query
|
||||||
"CREATE TABLE session (
|
"CREATE TABLE jjj.session (
|
||||||
id TEXT NOT NULL PRIMARY KEY,
|
id TEXT NOT NULL PRIMARY KEY,
|
||||||
payload BYTEA NOT NULL,
|
payload BYTEA NOT NULL,
|
||||||
expire_at TIMESTAMPTZ NOT NULL,
|
expire_at TIMESTAMPTZ NOT NULL,
|
||||||
|
@ -100,7 +100,7 @@ type DistributedCache () =
|
||||||
let idParam = "@id", Sql.string key
|
let idParam = "@id", Sql.string key
|
||||||
let! tryEntry =
|
let! tryEntry =
|
||||||
dataSource
|
dataSource
|
||||||
|> Sql.query "SELECT * FROM session WHERE id = @id"
|
|> Sql.query "SELECT * FROM jjj.session WHERE id = @id"
|
||||||
|> Sql.parameters [ idParam ]
|
|> Sql.parameters [ idParam ]
|
||||||
|> Sql.executeAsync (fun row ->
|
|> Sql.executeAsync (fun row ->
|
||||||
{ Id = row.string "id"
|
{ Id = row.string "id"
|
||||||
|
@ -123,7 +123,7 @@ type DistributedCache () =
|
||||||
if needsRefresh then
|
if needsRefresh then
|
||||||
let! _ =
|
let! _ =
|
||||||
dataSource
|
dataSource
|
||||||
|> Sql.query "UPDATE session SET expire_at = @expireAt WHERE id = @id"
|
|> Sql.query "UPDATE jjj.session SET expire_at = @expireAt WHERE id = @id"
|
||||||
|> Sql.parameters [ expireParam item.ExpireAt; idParam ]
|
|> Sql.parameters [ expireParam item.ExpireAt; idParam ]
|
||||||
|> Sql.executeNonQueryAsync
|
|> Sql.executeNonQueryAsync
|
||||||
()
|
()
|
||||||
|
@ -140,7 +140,7 @@ type DistributedCache () =
|
||||||
if lastPurge.Plus (Duration.FromMinutes 30L) < now then
|
if lastPurge.Plus (Duration.FromMinutes 30L) < now then
|
||||||
let! _ =
|
let! _ =
|
||||||
dataSource ()
|
dataSource ()
|
||||||
|> Sql.query "DELETE FROM session WHERE expire_at < @expireAt"
|
|> Sql.query "DELETE FROM jjj.session WHERE expire_at < @expireAt"
|
||||||
|> Sql.parameters [ expireParam now ]
|
|> Sql.parameters [ expireParam now ]
|
||||||
|> Sql.executeNonQueryAsync
|
|> Sql.executeNonQueryAsync
|
||||||
lastPurge <- now
|
lastPurge <- now
|
||||||
|
@ -150,7 +150,7 @@ type DistributedCache () =
|
||||||
let removeEntry key = backgroundTask {
|
let removeEntry key = backgroundTask {
|
||||||
let! _ =
|
let! _ =
|
||||||
dataSource ()
|
dataSource ()
|
||||||
|> Sql.query "DELETE FROM session WHERE id = @id"
|
|> Sql.query "DELETE FROM jjj.session WHERE id = @id"
|
||||||
|> Sql.parameters [ "@id", Sql.string key ]
|
|> Sql.parameters [ "@id", Sql.string key ]
|
||||||
|> Sql.executeNonQueryAsync
|
|> Sql.executeNonQueryAsync
|
||||||
()
|
()
|
||||||
|
@ -176,7 +176,7 @@ type DistributedCache () =
|
||||||
let! _ =
|
let! _ =
|
||||||
dataSource ()
|
dataSource ()
|
||||||
|> Sql.query
|
|> Sql.query
|
||||||
"INSERT INTO session (
|
"INSERT INTO jjj.session (
|
||||||
id, payload, expire_at, sliding_expiration, absolute_expiration
|
id, payload, expire_at, sliding_expiration, absolute_expiration
|
||||||
) VALUES (
|
) VALUES (
|
||||||
@id, @payload, @expireAt, @slideExp, @absExp
|
@id, @payload, @expireAt, @slideExp, @absExp
|
||||||
|
|
Loading…
Reference in New Issue
Block a user