public ItemInfo Get(string itemId) { string key = "inventoryitem_" + itemId; if (CachingEnabled) { var cached = ServiceSharedCore.RedisCacheManager.Get <ItemInfo>(key); if (cached != null) { return(cached); } //the Item controller has a method that retrieves a superset of the info needed here, check if that's cached too key = "item_" + itemId; cached = ServiceSharedCore.RedisCacheManager.Get <ItemInfo>(key); if (cached != null) { return(cached); } } var dbResult = DBFacilitator.GetOne <ItemInfo>( PostgreSQLConnectionString, SQL_GET_INVENTORY_BY_ITEM, new List <Tuple <string, string, NpgsqlDbType> >() { { new Tuple <string, string, NpgsqlDbType>("itemId", itemId, NpgsqlDbType.Text) } }); if (CachingEnabled) { ServiceSharedCore.RedisCacheManager.Store(key, dbResult); } return(dbResult); }
public ItemInfo GetItem(string itemId) { string key = "item_" + itemId; if (CachingEnabled) { var cached = ServiceSharedCore.RedisCacheManager.Get <ItemInfo>(key); if (cached != null) { return(cached); } } var dbResult = DBFacilitator.GetOne <ItemInfo>( PostgreSQLConnectionString, SQL_SELECT_ITEMS_BY_ID, new List <Tuple <string, string, NpgsqlDbType> >() { { new Tuple <string, string, NpgsqlDbType>("itemId", itemId, NpgsqlDbType.Text) } }); if (CachingEnabled) { ServiceSharedCore.RedisCacheManager.Store(key, dbResult); } return(dbResult); }
public ItemInfo GetItem(string itemId) { return(DBFacilitator.GetOne <ItemInfo>( ConfigSettings.PostgreSQLConnectionString, SQL_SELECT_ITEMS_BY_ID, new List <Tuple <string, string, NpgsqlDbType> >() { { new Tuple <string, string, NpgsqlDbType>("itemId", itemId, NpgsqlDbType.Text) } })); }
public ItemInfo Get(string itemId) { return(DBFacilitator.GetOne <ItemInfo>( PostgreSQLConnectionString, SQL_GET_INVENTORY_BY_ITEM, new List <Tuple <string, string, NpgsqlDbType> >() { { new Tuple <string, string, NpgsqlDbType>("itemId", itemId, NpgsqlDbType.Text) } })); }
public ProductInfo GetProduct(string productId) { return(DBFacilitator.GetOne <ProductInfo>( ConfigSettings.PostgreSQLConnectionString, SQL_SELECT_PRODUCT, new List <Tuple <string, string, NpgsqlDbType> >() { { new Tuple <string, string, NpgsqlDbType>(":productId", productId, NpgsqlDbType.Text) } })); }
public Cart GetUniqueID([FromBody] GetUniqueId uniqueIdInfo) { return(DBFacilitator.GetOne <Cart>( PostgreSQLConnectionString, GET_UNIQUEID_FOR_USER, new List <Tuple <string, string, NpgsqlDbType> >() { { new Tuple <string, string, NpgsqlDbType>(":Username", uniqueIdInfo.UserName, NpgsqlDbType.Text) }, { new Tuple <string, string, NpgsqlDbType>(":ApplicationName", uniqueIdInfo.AppName, NpgsqlDbType.Text) } } )); }
public ProductInfo GetProduct(string productId) { string key = "product_" + productId; var cached = ServiceSharedCore.RedisCacheManager.Get<ProductInfo>(key); if (cached != null) return cached; var dbResult = DBFacilitator.GetOne<ProductInfo>( ConfigSettings.PostgreSQLConnectionString, SQL_SELECT_PRODUCT, new List<Tuple<string, string, NpgsqlDbType>>() { { new Tuple<string, string, NpgsqlDbType>(":productId", productId, NpgsqlDbType.Text) } }); ServiceSharedCore.RedisCacheManager.Store(key, dbResult); return dbResult; }