title: Symfony LockHandler
body: <p>I am thinking about using the LockHandler but have a question. Will a lock prohibit the same command from being run within a different instance of a project? In other words, I may be running multiple instances of my project on one server under different VHOSTs. (ie www.instance1.com &amp; www.instance2.com)If I setup a cron job for each project to run the command "app:cron" would the first project that executes the command stop the other project from running its "app:cron" command if they happened to overlap each other or even fire at the same time?</p>
  
  <p>If so, when I construct the lockhandler should I just inject an instance specific name into the constructor?</p>
  
  <p>ie</p>
  
  <p>First Instance:</p>
  
  <pre><code>new LockHandler('instance1.hello.lock');
  </code></pre>
  
  <p>Second Instance:</p>
  
  <pre><code>new LockHandler('instance2.hello.lock');
  </code></pre>
  
  <p>@Kadriles answer below is correct, Just to add, for anyone else looking into this.</p>
  
  <p>The LockHandler uses the PHP function sys_get_temp_dir() to get the temp folder to use. It creates files in the following format (using my instance1 example above): sf.instance1-hello-lock.[64CHAR HASH].lock
  When you create a lock Symfony "opens" the file so the filessytem sees the file is in use, when it releases it, it "closes" the file but does not actually delete it - this threw me off for a couple minutes.</p>
  
  <p>I ended up creating a parameter for the host and prepending that to the name used in the constructor like so:</p>
  
  <pre><code>$host = $this-&gt;getContainer()-&gt;getParameter('router.request_context.host');
  new LockHandler($host . '.hello.lock');
  </code></pre>