Files
postgres-web/sql/varnish.sql
Magnus Hagander 33ed40343b Add support for varnish purging based on expressions
Previously we would only purge based on URLs, but some of the upcoming
new work requires arbitrary expression purging.

NOTE! Require the creation of the new SQL procecure in the database,
either from varnish.sql or varnish_local.sql depending on if it's prod
or dev.
2012-10-03 12:48:47 +02:00

21 lines
498 B
PL/PgSQL

BEGIN;
--
-- Create a function to purge from varnish cache
-- By default this adds the object to a pgq queue,
-- but this function can be replaced with a void one
-- when running a development version.
--
CREATE OR REPLACE FUNCTION varnish_purge(url text)
RETURNS bigint
AS $$
SELECT pgq.insert_event('varnish', 'P', $1);
$$ LANGUAGE 'sql';
CREATE OR REPLACE FUNCTION varnish_purge_expr(expr text)
RETURNS bigint
AS $$
SELECT pgq.insert_event('varnish', 'X', $1);
$$ LANGUAGE 'sql';
COMMIT;