summaryrefslogtreecommitdiff
path: root/index.php
blob: 3daeb7e0798353f701e9dc4402e8162613991c18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require_once __DIR__ . '/bootstrap.php';

$user = "feed@maxmail.xyz";
$pass = "1234abc";
#$inbox = array("INBOX", "Trash");
$inbox = array("INBOX");
$max_items = 10;
$ttl = 60*60;

$mail = getMail($user, $pass, $inbox, $max_items);

$inbox_string = implode(",", $inbox);

$cache_key = md5($user . $inbox_string);
$client = new Predis\Client('tcp://127.0.0.1:6379?database=2');

$feed = $client->get('feed_' . $cache_key);
if ( false !== $feed ) {
	$feed = generate_feed($mail, $user, $inbox_string);
	$client->set('feed_' . $cache_key, $feed);
	$client->expire('feed_' . $cache_key, $ttl);
}

header("Content-type: application/rss+xml");
echo $feed;