12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- use Redis\Logger\Reader;
- use Redis\Logger\Settings;
- $redis = new Redis();
- $redis->connect('localhost');
- require_once "lib/Redis/Logger/Settings.php";
- require_once "lib/Redis/Logger/Entry.php";
- require_once "lib/Redis/Logger/Reader.php";
- require_once "lib/Redis/Logger/Writer.php";
- $reader = new Reader($redis);
- echo "\nscan()-ing Template pattern: " . Settings::REDIS_PATTERN . "\n";
- echo implode(', ', $templates = $reader->scan(Settings::REDIS_PATTERN, 0, 50)) . "\n\n";
- echo "getChannels: ";
- $channels = $reader->getChannels();
- echo implode(', ', $channels) . "\n\n";
- echo "getTemplates():\n";
- $templates = $reader->getTemplates();
- echo "Result: " . implode(', ', $templates) . "\n\n";
- echo "getTemplates('cli'):\n";
- $templates = $reader->getTemplates("cli");
- echo "Result: " . implode(', ', $templates) . "\n\n";
- echo "getTemplates('foo'):\n";
- $templates = $reader->getTemplates("foo");
- echo "Result: " . implode(', ', $templates) . "\n\n";
- echo "getTemplates(NULL, 4):\n";
- $templates = $reader->getTemplates(NULL, 4);
- echo "Result: " . implode(', ', $templates) . "\n\n";
- echo "getTemplates(NULL, 5):\n";
- $templates = $reader->getTemplates(NULL, 5);
- echo "Result: " . implode(', ', $templates) . "\n\n";
- foreach ($reader->getTemplates() as $template) {
- echo "First page of events for template <$template>:\n";
- $entries = $reader->getEntries($template);
- foreach ($entries as $entry) {
- echo "$entry\n";
- }
- }
- echo "First page of events for template <nonexistent>:\n";
- $entries = $reader->getEntries("nonexistent");
- foreach ($entries as $entry) {
- echo "$entry\n";
- }
|