Skip to content
Fernando Correa de Oliveira edited this page May 11, 2019 · 1 revision
use Red;
use Red::Driver::Cache;

my $*RED-DB = cache "Memory", "SQLite";
my $*RED-CACHE-DEBUG = True;
model Bla { has Int $.a is column }

Bla.^create-table;
Bla.^create: :a($_) for ^6;

.say for Bla.^all.grep: *.a > 3;
.say for Bla.^all.grep: *.a > 3;

Output:

get-from-cache: CACHED_SELECT:bla.a:FROM:bla:WHERE:bla.a::num_>_3
setting data on cache
set-on-cache: CACHED_SELECT:bla.a:FROM:bla:WHERE:bla.a::num_>_3
Bla.new(a => 4)
Bla.new(a => 5)
get-from-cache: CACHED_SELECT:bla.a:FROM:bla:WHERE:bla.a::num_>_3
getting data from cache
Bla.new(a => 4)
Bla.new(a => 5)