Converting cache qurey to sqlite pdo