public static void Increment(DbEventObject eventObject) { GlobalStore.Increment(eventObject); if (!string.IsNullOrEmpty(eventObject.Username)) { EventStore userStore = GetUserStore(eventObject.Username); userStore.Increment(eventObject); } }
/// <summary> /// Logs an event in the LiteDB database storing the ID of the Core item of the clicked Content Editor ribbon button and the current Sitecore user's username. /// </summary> /// <param name="referenceId"></param> /// <param name="userName"></param> public void LogEvent(string referenceId, string userName) { DbEventObject dbEventObject = new DbEventObject { ReferenceId = referenceId, Timestamp = DateTime.Now, Username = userName.ToLowerInvariant() }; using (var db = new LiteDatabase(string.Format("{0}\\{1}", dataFolder, dbName))) { var events = db.GetCollection <DbEventObject>("events"); events.Insert(dbEventObject); } }
public void Increment(DbEventObject eventObject) { string cacheKey = GetCacheKey(eventObject); try { Lock.EnterWriteLock(); if (!EventCounts.ContainsKey(cacheKey)) { EventCounts.Add(cacheKey, 0); EventObjects.Add(cacheKey, eventObject); } ++EventCounts[cacheKey]; } finally { Lock.ExitWriteLock(); } }
private string GetCacheKey(DbEventObject eventObject) { return(eventObject.ReferenceId); }
public void Add(DbEventObject dbEventObject) { throw new NotImplementedException(); }