File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change 1- defmodule RabbitMQ.Supervisor do
1+ defmodule RabbitMQ.CacheSupervisor do
22 use DynamicSupervisor
33
4- def start ( _type , args ) do
5- DynamicSupervisor . start_link ( __MODULE__ , args , name: __MODULE__ )
4+ require RabbitMQ.Cache
5+
6+ def start_link ( ) do
7+ case DynamicSupervisor . start_link ( __MODULE__ , [ ] , name: __MODULE__ ) do
8+ { :ok , _pid } -> :ok
9+ _ -> :error
10+ end
611 end
712
8- def start_child ( spec ) do
9- DynamicSupervisor . start_child ( __MODULE__ , spec )
13+ def start_cache ( cache , options ) do
14+ specifications = % { id: cache ,
15+ start: { RabbitMQ.Cache , :start_link , [ cache , options ] } }
16+
17+ case DynamicSupervisor . start_child ( __MODULE__ , specifications ) do
18+ { :ok , _ } -> :ok
19+ { :error , { :already_started , _ } } -> :ok
20+ _ -> :error
21+ end
1022 end
1123
12- def terminate_child ( name ) do
13- DynamicSupervisor . terminate_child ( __MODULE__ , name )
24+ def stop_cache ( cache ) do
25+ DynamicSupervisor . terminate_child ( __MODULE__ , RabbitMQ.Cache . process ( cache ) )
1426 end
1527
1628 def init ( _args ) do
You can’t perform that action at this time.
0 commit comments