| Path: | sqlite3_feed_cache.rb |
| Last Update: | Thu Mar 09 00:05:17 CET 2006 |
Implements a custom feed cache store for FeedTools. All data is stored in an SQLite3 database.
This is not the most efficient implementation (the database connection isn’t kept open in between method calls), and at times it’s even a little rude (we only pretend to react on initialize_cache, set_up_correctly?, etc) but at least it’s threadsafe (which was my reason to implement this in the first place).
Requires FeedTools 0.2.23 and the SQLite3 gem.
You need to set up the cache database yourself — it uses the same schema as FeedTools’ DatabaseFeedCache.
I suggest a simple change though: I’m using a TIMESTAMP for the last_retrieved field (FeedTools uses DATETIME, but this triggered weird timezone conversion issues on my system, even when using the default DatabaseFeedCache).
CREATE TABLE cached_feeds (
id INTEGER PRIMARY KEY NOT NULL,
href VARCHAR(255) DEFAULT NULL,
title VARCHAR(255) DEFAULT NULL,
link VARCHAR(255) DEFAULT NULL,
feed_data TEXT DEFAULT NULL,
feed_data_type VARCHAR(20) DEFAULT NULL,
http_headers TEXT DEFAULT NULL,
last_retrieved TIMESTAMP DEFAULT NULL
);
TODO:
By Martin Dittus (martin_at_dekstop_dot_de), 2006-03-07 — last change: 2006-03-08