| 1 | package CHI::Driver::MemcachedFast::Test::Driver; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use base qw(CHI::Driver::MemcachedFast); | ||
| 5 | |||
| 6 | # Memcached doesn't support get_keys. For testing purposes, define get_keys | ||
| 7 | # by checking for all keys used during testing. | ||
| 8 | # | ||
| 9 | |||
| 10 | # Reverse declare_unsupported_methods | ||
| 11 | # | ||
| 12 | foreach my $method (qw(dump_as_hash is_empty purge)) { | ||
| 13 | no strict 'refs'; | ||
| 14 | *{ __PACKAGE__ . "::$method" } = sub { | ||
| 15 | my $self = shift; | ||
| 16 | my $full_method = "CHI::Driver::$method"; | ||
| 17 | return $self->$full_method(@_); | ||
| 18 | }; | ||
| 19 | } | ||
| 20 | |||
| 21 | my @all_test_keys = ( | ||
| 22 | 'space', 'a', 0, 1, 'medium', 'mixed', scalar( 'ab' x 100 ), | ||
| 23 | 'arrayref', 'hashref', map { "done$_" } ( 0 .. 2 ), | ||
| 24 | ); | ||
| 25 | |||
| 26 | sub get_keys { | ||
| 27 | my $self = shift; | ||
| 28 | |||
| 29 | return map { defined $self->get($_) ? ($_) : () } @all_test_keys; | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; |