Laravel Query Builder:缓存列表结果

时间:2016-07-30 17:40:55

标签: php laravel laravel-5 laravel-query-builder

可以像这样缓存查询结果:

E: Unable to locate package man

但是如何缓存列表结果。这不起作用:

$users = DB::table('users')->remember(10)->get();

抛出错误:

$roles = DB::table('roles')->lists('title'); // Works, but not cached.
$roles = DB::table('roles')->remember(10)->lists('title'); // Not working.

1 个答案:

答案 0 :(得分:4)

在laravel 5+中删除了private void dataGridViewWendys_CellContentClick(object sender, DataGridViewCellEventArgs e)//Start of code for Wendys DataGridView Cell Content { if(e.RowIndex>=0) { DataGridViewRow row = dataGridViewWendys.Rows[e.RowIndex]; txt_ID.Text = row.Cells["ID"].Value.ToString(); txt_Nickname.Text = row.Cells["Nickname"].Value.ToString(); txt_ProjNumber.Text = row.Cells["ProjectNumber"].Value.ToString(); txt_ProjYear.Text = row.Cells["ProjectYear"].Value.ToString(); txt_StoreNumber.Text = row.Cells["StoreNumber"].Value.ToString(); txt_StreetAddress.Text = row.Cells["StreetAddress"].Value.ToString(); txt_city.Text = row.Cells["City"].Value.ToString(); cb_State.Text = row.Cells["State"].Value.ToString(); txt_ZipCode.Text = row.Cells["Zipcode"].Value.ToString(); cb_AssetType.Text = row.Cells["AssetType"].Value.ToString(); cb_BaseModel.Text = row.Cells["BaseModel"].Value.ToString(); cb_BldgPrototypeYear.Text = row.Cells["BldgPrototypeYear"].Value.ToString(); cb_UpgradeClass.Text = row.Cells["UpgradeClass"].Value.ToString(); cb_ExtWallStructure.Text = row.Cells["ExtWallStructure"].Value.ToString(); cb_NewWallStructure.Text = row.Cells["NewWallStructure"].Value.ToString(); ckb_StructDwgs.Checked = row.Cells["StructuralDwgs"].Value; cb_BladeDesign.Text = row.Cells["BladeDesign"].Value.ToString(); //ckb_CurtainWall.Checked = row.Cells["CurtainWall"].Value.ToString(); //Corragated Metal Above Windows.c = row.Cells["CorrugatedMlFrt"].Value.ToString(); cb_Addition.Text = row.Cells["Addition"].Value.ToString(); //ckb_SecondPUW.Checked = row.Cells["SecondPUW"].Value.ToString(); //ckb_PUWExtention.checked = row.Cells["PUWWindowExtention"].Value.ToString(); cb_ExtFndType.Text = row.Cells["ExstFoundationType"].Value.ToString(); cb_NewFndType.Text = row.Cells["NewFoundationType"].Value.ToString(); //ckb_PUWVestibule.Checked = row.Cells["PUWVestibule"].Value.ToString(); //ckb_NonPUWVestibule.Checked = row.Cells["NonPUWVestibule"].Value.ToString(); cb_DriveThruType.Text = row.Cells["DriveThruType"].Value.ToString(); cb_TrashEnclosure.Text = row.Cells["TrashEnclosure"].Value.ToString(); cb_MenuboardType.Text = row.Cells["DigitalStatic"].Value.ToString(); cb_Patio.Text = row.Cells["Patio"].Value.ToString(); //ckb_ExtTrayWash.Checked = row.Cells["ExtgTrayWash"].Value.ToString(); cb_SelfServe.Text = row.Cells["SelfServe"].Value.ToString(); //ckb_SpandrelGlass.Checked = row.Cells["SpandrelGlass"].Value.ToString(); cb_CounterStyle.Text = row.Cells["CounterStyle"].Value.ToString(); cb_RaisedCeiling.Text = row.Cells["RaisedCeiling"].Value.ToString(); //ckb_KitchenWork.Checked = row.Cells["KitchenWork"].Value.ToString(); //ckb_ElecGasHeat.Checked = row.Cells["ElecGasHeat"].Value.ToString(); //ckb_ElecGasfryer.Checked = row.Cells["ElecGasFryers"].Value.ToString(); //ckb_ElecGasGrille.Checked = row.Cells["ElecGasGrilles"].Value.ToString(); //ckbBlockBands.Checked = row.Cells["BlockBands"].Value.ToString(); list_Notes.Text = row.Cells["Notes"].Value.ToString(); cb_ExtRoofStructure.Text = row.Cells["ExtRoofStructure"].Value.ToString(); cb_NewRoofStructure.Text = row.Cells["NewRoofStructure"].Value.ToString(); ,您可以使用此代码:

Illuminate\Database\Query\Builder::remember()

我希望这会对你有所帮助。