Skip to content

Commit

Permalink
Rename Cache Item -> Entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
636f7374 committed Apr 14, 2020
1 parent 5fb6e51 commit 76c8b7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions src/durian/cache.cr
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,16 @@ class Durian::Cache
class RecordKind
property accessAt : Time
property tapCount : Int32
property a : Item?
property aaaa : Item?
property ns : Item?
property ptr : Item?
property cname : Item?
property soa : Item?
property txt : Item?
property mx : Item?
property dname : Item?
property srv : Item?
property a : Entry?
property aaaa : Entry?
property ns : Entry?
property ptr : Entry?
property cname : Entry?
property soa : Entry?
property txt : Entry?
property mx : Entry?
property dname : Entry?
property srv : Entry?

def initialize(@accessAt : Time = Time.local, @tapCount : Int32 = 0_i32)
@a = nil
Expand All @@ -184,7 +184,7 @@ class Durian::Cache

{% for name in RecordType %}
def create_{{name.downcase.id}}
@{{name.downcase.id}} = Item.new
@{{name.downcase.id}} = Entry.new
end
{% end %}

Expand Down Expand Up @@ -222,7 +222,7 @@ class Durian::Cache
record? flag
end

class Item
class Entry
property packet : Durian::Packet::Response?
property updateAt : Time

Expand Down
8 changes: 4 additions & 4 deletions src/durian/cache/ip_address.cr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module Durian
class Cache::IPAddress
property collects : Immutable::Map(String, Item)
property collects : Immutable::Map(String, Entry)
property capacity : Int32
property cleanInterval : Time::Span
property recordExpires : Time::Span
property cleanAt : Time
property maximumCleanup : Int32

def initialize(@collects = Immutable::Map(String, Item).new, @capacity : Int32 = 256_i32,
def initialize(@collects = Immutable::Map(String, Entry).new, @capacity : Int32 = 256_i32,
@cleanInterval : Time::Span = 3600_i32.seconds, @recordExpires : Time::Span = 1800_i32.seconds)
@cleanAt = Time.local
@maximumCleanup = (capacity / 2_i32).to_i32
end

def insert(name : String, ip_address : Array(Socket::IPAddress))
insert = collects.set name, Item.new ip_address
insert = collects.set name, Entry.new ip_address
@collects = insert
end

Expand Down Expand Up @@ -159,7 +159,7 @@ module Durian
end
{% end %}

class Item
class Entry
property ipAddress : Array(Socket::IPAddress)
property accessAt : Time
property tapCount : Int32
Expand Down

0 comments on commit 76c8b7f

Please sign in to comment.