pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedLISTEN/NOTIFY
5+ messages / 4 participants
[nested] [flat]
* LISTEN/NOTIFY
@ 2002-10-04 20:49 Cristóvão Dalla Costa <cbraga@bsi.com.br>
0 siblings, 2 replies; 5+ messages in thread
From: Cristóvão Dalla Costa @ 2002-10-04 20:49 UTC (permalink / raw)
To: pgsql-general@postgresql.org
I'm developing an e-commerce site using Apache/mod_perl and, for
performance, I intend to cache rows such as user and product information
inside Perl. I think the LISTEN/NOTIFY interface would be perfect for
invalidating the cache when a product/user gets updated, yet I have not
found a way to access it from Perl -- DBI, or DBD::Pg even, offer no way
to "listen". Also, I don't really like the vanilla Pg. So, my question
to you is, is there another efficient way to accomplish notification of
updates?
Thank you
Cristóvão
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: LISTEN/NOTIFY
@ 2002-10-04 22:00 Jeff Davis <list-pgsql-general@empires.org>
parent: Cristóvão Dalla Costa <cbraga@bsi.com.br>
1 sibling, 0 replies; 5+ messages in thread
From: Jeff Davis @ 2002-10-04 22:00 UTC (permalink / raw)
To: Cristóvão Dalla Costa <cbraga@bsi.com.br>; pgsql-general@postgresql.org
I did something similar using python with a simple "getnotify()" function
(part of the python pg module).
I couldn't find a similar function for perl -- strange.
I think the listening process needs to be a separate process anyway, since I
wouldn't think that an apache process would easily be able to wait for a
notification.
You could just do the cache invalidation process in another language, like
python or C, and all that would do is listen for an update, read the updated
info, and replace the cache. It should be small enough that you don't mind
straying from perl, hopefully.
Of course it is weird that perl doesn't support that. Maybe I missed something
too.
Regards,
Jeff Davis
On Friday 04 October 2002 01:49 pm, Cristóvão Dalla Costa wrote:
> I'm developing an e-commerce site using Apache/mod_perl and, for
> performance, I intend to cache rows such as user and product information
> inside Perl. I think the LISTEN/NOTIFY interface would be perfect for
> invalidating the cache when a product/user gets updated, yet I have not
> found a way to access it from Perl -- DBI, or DBD::Pg even, offer no way
> to "listen". Also, I don't really like the vanilla Pg. So, my question
> to you is, is there another efficient way to accomplish notification of
> updates?
>
> Thank you
>
> Cristóvão
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: LISTEN/NOTIFY
@ 2002-10-05 02:54 Tom Lane <tgl@sss.pgh.pa.us>
parent: Cristóvão Dalla Costa <cbraga@bsi.com.br>
1 sibling, 1 reply; 5+ messages in thread
From: Tom Lane @ 2002-10-05 02:54 UTC (permalink / raw)
To: Cristóvão Dalla Costa <cbraga@bsi.com.br>; +Cc: pgsql-general@postgresql.org; pgsql-interfaces
=?ISO-8859-1?Q?Crist=F3v=E3o_Dalla_Costa?= <cbraga@bsi.com.br> writes:
> I'm developing an e-commerce site using Apache/mod_perl and, for
> performance, I intend to cache rows such as user and product information
> inside Perl. I think the LISTEN/NOTIFY interface would be perfect for
> invalidating the cache when a product/user gets updated, yet I have not
> found a way to access it from Perl -- DBI, or DBD::Pg even, offer no way
> to "listen".
I don't know what the DBI/DBD design philosophy is regarding
database-specific extensions --- but it would seem reasonable to me
for DBD::Pg to offer some way to get at LISTEN functionality. Can
anyone suggest how to do this in the context of DBI?
I suggest moving any followups to pgsql-interfaces, where this
discussion would be more on-topic.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [INTERFACES] LISTEN/NOTIFY
@ 2002-10-06 00:29 alex@pilosoft.com
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: alex@pilosoft.com @ 2002-10-06 00:29 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces
On Fri, 4 Oct 2002, Tom Lane wrote:
> =?ISO-8859-1?Q?Crist=F3v=E3o_Dalla_Costa?= <cbraga@bsi.com.br> writes:
> > I'm developing an e-commerce site using Apache/mod_perl and, for
> > performance, I intend to cache rows such as user and product information
> > inside Perl. I think the LISTEN/NOTIFY interface would be perfect for
> > invalidating the cache when a product/user gets updated, yet I have not
> > found a way to access it from Perl -- DBI, or DBD::Pg even, offer no way
> > to "listen".
See this:
http://archives.postgresql.org/pgsql-interfaces/2002-01/msg00018.php
> I don't know what the DBI/DBD design philosophy is regarding
> database-specific extensions --- but it would seem reasonable to me for
> DBD::Pg to offer some way to get at LISTEN functionality. Can anyone
> suggest how to do this in the context of DBI?
It uses generic func() interface...
> I suggest moving any followups to pgsql-interfaces, where this
> discussion would be more on-topic.
-alex
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [INTERFACES] LISTEN/NOTIFY
@ 2002-10-06 01:08 Tom Lane <tgl@sss.pgh.pa.us>
parent: alex@pilosoft.com
0 siblings, 0 replies; 5+ messages in thread
From: Tom Lane @ 2002-10-06 01:08 UTC (permalink / raw)
To: alex@pilosoft.com; +Cc: pgsql-general@postgresql.org; pgsql-interfaces
alex@pilosoft.com writes:
> See this:
> http://archives.postgresql.org/pgsql-interfaces/2002-01/msg00018.php
Ah, I'd forgotten about that. Did it get accepted into DBD::Pg?
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2002-10-06 01:08 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-04 20:49 LISTEN/NOTIFY Cristóvão Dalla Costa <cbraga@bsi.com.br>
2002-10-04 22:00 ` Jeff Davis <list-pgsql-general@empires.org>
2002-10-05 02:54 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-10-06 00:29 ` alex@pilosoft.com
2002-10-06 01:08 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox