Skip to content

Commit

Permalink
Merge pull request #4 from crystal-cache/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mamantoha committed Sep 21, 2022
2 parents 9d98860 + 780af33 commit cbcea7e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021 Anton Maminov <anton.maminov@gmail.com>
Copyright (c) 2021-2022 Anton Maminov <anton.maminov@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mysql_cache_store
description: Cache::Store implementation backed by a MySQL database via crystal-mysql.
version: 0.1.0
version: 0.2.0

authors:
- Anton Maminov <anton.maminov@gmail.com>
Expand All @@ -10,7 +10,7 @@ crystal: ">= 1.0.0"
dependencies:
cache:
github: crystal-cache/cache
version: ">= 0.12.0"
version: ">= 0.14.0"
mysql:
github: crystal-lang/crystal-mysql

Expand Down
4 changes: 2 additions & 2 deletions src/mysql_cache_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ module Cache
value
end

def delete(key : K) : Bool
private def delete_impl(key : K) : Bool
sql = "DELETE from `#{@table_name}` WHERE `key` = ?"

result = @mysql.exec(sql, key)

result.rows_affected.zero? ? false : true
end

def exists?(key : K) : Bool
private def exists_impl(key : K) : Bool
sql = "SELECT `created_at`, `expires_in` FROM `#{@table_name}` WHERE `key` = ?"

rs = @mysql.query_one?(sql, key, as: {Time, Int32})
Expand Down

0 comments on commit cbcea7e

Please sign in to comment.