Class: UnitHosting::Cache

Inherits:
PStore
  • Object
show all
Defined in:
lib/unit-hosting/cache.rb

Instance Method Summary collapse

Instance Method Details

#groupsObject



8
9
10
11
12
# File 'lib/unit-hosting/cache.rb', line 8

def groups
  transaction { |ps|
    ps["groups"] ||= [].extend(UnitHosting::Groups)
  }
end

#update_all_groups!(gs) ⇒ Object



14
15
16
17
18
# File 'lib/unit-hosting/cache.rb', line 14

def update_all_groups! gs
  transaction { |ps|
    ps["groups"] = gs.update
  }
end

#update_group!(group) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/unit-hosting/cache.rb', line 20

def update_group! group
  transaction { |ps|
    groups = ps["groups"].reject { |g|
      g.instance_id == group.instance_id
    }
    groups << group.update
    ps["groups"] = groups
  }
end