func (object *User) Delete() { connection := database.GetConnection() defer connection.Release() logger.Debug("[Database] Deleting User") collection := connection.C(object.Collection()) collection.RemoveId(object.Id) key := object.ApplicationId.Hex() + ".users." + object.Id.Hex() cache.Clear(key) }
func (object *Endpoint) Save() { connection := database.GetConnection() defer connection.Release() logger.Debug("[Database] Saving Endpoint") collection := connection.C(object.Collection()) if object.Id == bson.ObjectId("") { object.Id = bson.NewObjectId() collection.Insert(object) } else { collection.UpdateId(object.Id, object) } key := object.ApplicationId.Hex() + ".endpoints." + object.Id.Hex() cache.Clear(key) }