Skip to content

Instantly share code, notes, and snippets.

@corkupine
Created October 12, 2012 21:36
Show Gist options
  • Save corkupine/3881660 to your computer and use it in GitHub Desktop.
Save corkupine/3881660 to your computer and use it in GitHub Desktop.
index creation
public class IndexedRepo
{
private IClient _client;
private static bool _indexCreated;
private static readonly object _locker = new object();
public IndexedRepo(IClient client)
{
this._client = client;
lock(_locker)
{
if (!_indexCreated) {CreateIndex(client);}
}
}
private static void CreateIndex(IClient client)
{
if (client.IndexExists("splorf")
{
_indexCreated = true;
return;
}
//Do stuff to create index
_indexCreated = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment