奇数缓存逻辑:当内存缓存已满时,不添加任何项,但将其删除

时间:2018-10-02 03:02:07

标签: caching asp.net-core asp.net-core-2.1

在ASP.NET Core项目中,我正在使用Docs: Cache-in-memory in ASP.NET Core中所述的内存缓存。

使用文档中的$viewquery= mysqli_query($connection,"SELECT * from orders"); while($row = mysqli_fetch_assoc($viewquery)) { $id =$row['id']; $full_name =$row['full_name']; $email_address =$row['email_address']; $contact_number =$row['contact_number']; $address =$row['address']; $user_id =$row['user_id']; $reference_number =$row['reference_number']; $additional =$row['additional']; $payment_method =$row['payment_method']; $transaction_status = $row['transaction_status']; echo' <tr>'; echo '<td>';echo "<a href='#?idrequest=$id'><button type='button' class='btn btn-primary' data-toggle='modal' data-target='#exampleModalLong' data-formid='.$id.'> $reference_number </button></a>"; echo'</td>'; echo " <td> $id </td> <td> $full_name </td> <td> $email_address </td> <td> $contact_number </td> <td> $address </td> <td> $user_id</td> <td> $additional </td> <td> $payment_method </td> <td> $transaction_status </td> <td> <a href='delete.php'> <i class='material-icons' id='coloricon'>delete </i> </a> </td> </tr> "; } ?> <div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5> <button type="button" class="close" data-dismiss="modal" aria- label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <?php include("conn.php"); $idrequest = $_GET['idrequest']; $query = "SELECT * from orders where id ='$idrequest'"; $result = mysqli_query($connection,$query); $view = mysqli_fetch_assoc($result); $details = $view['summary_all']; echo $details; ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data- dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div> ,我发现行为异常。当缓存已满并且我尝试向缓存中添加项目时-现有项目从缓存中删除(因此缓存不再满),但是未添加新项目。这是错误还是预期的行为?

MyMemoryCache

0 个答案:

没有答案