[ https://issues.apache.org/jira/browse/GEODE-8601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17311281#comment-17311281 ]
ASF GitHub Bot commented on GEODE-8601: --------------------------------------- gaussianrecurrence commented on a change in pull request #678: URL: https://github.com/apache/geode-native/pull/678#discussion_r603897236 ########## File path: cppcache/src/CacheStatistics.cpp ########## @@ -21,20 +21,20 @@ namespace apache { namespace geode { namespace client { -void CacheStatistics::setLastModifiedTime(time_point lmt) { - m_lastModifiedTime = lmt.time_since_epoch().count(); +void CacheStatistics::setLastModifiedTime(const time_point& tp) { + last_modified_ = tp.time_since_epoch().count(); Review comment: Explained in my comment below ########## File path: cppcache/src/EntryExpiryTask.cpp ########## @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "EntryExpiryTask.hpp" + +#include "CacheImpl.hpp" +#include "RegionInternal.hpp" + +namespace apache { +namespace geode { +namespace client { + +EntryExpiryTask::EntryExpiryTask(ExpiryTaskManager& manager, + std::shared_ptr<RegionInternal> region, + std::shared_ptr<MapEntryImpl> entry, + ExpirationAction action, + const duration_t& duration) + : ExpiryTask(manager), + duration_(duration), + action_(action), + entry_(entry), + region_(region) {} + +EntryExpiryTask::time_point_t EntryExpiryTask::expire_at() const { + auto& properties = entry_->getExpProperties(); + auto last_time = properties.last_accessed(); + if (region_->getAttributes().getEntryTimeToLive() > + std::chrono::seconds::zero()) { + last_time = properties.last_modified(); + } + + return last_time + duration_; +} + +bool EntryExpiryTask::on_expire() { + auto tp = expire_at(); + if (tp > ExpiryTask::clock_t::now()) { + // Entry expiration needs to be re-scheduled as it was accessed/modified + // since the last time the expiration task was (re-)scheduled. + // This is the best approach, rather than re-scheduling the task each time + // the entry is accessed/modified, as access/modify is a more frequent + // event than expiration. + reset(tp); + return false; + } + + // Pass a blank version tag. + std::shared_ptr<CacheableKey> key; + std::shared_ptr<VersionTag> versionTag; + + entry_->getKeyI(key); + + const auto full_path = region_->getFullPath().c_str(); + auto key_str = Utils::nullSafeToString(key); + + switch (action_) { + case ExpirationAction::INVALIDATE: { + LOGDEBUG( + "EntryExpiryTask::DoTheExpirationAction INVALIDATE " Review comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Replace ACE ExpiryTaskManager impl by boost::asio one > ----------------------------------------------------- > > Key: GEODE-8601 > URL: https://issues.apache.org/jira/browse/GEODE-8601 > Project: Geode > Issue Type: Improvement > Components: native client > Reporter: Mario Salazar de Torres > Assignee: Mario Salazar de Torres > Priority: Major > Labels: obliterate-ace, pull-request-available > > *AS A* native client contributor > *I WOULD LIKE* to replace ACE implementation of ExpiryTaskManager for a > boost::asio one > *SO THAT* all issues related to it disappear, the implementation is more > simple and move away from ACE as it's the project policy for a while. > — > *Additional information* > Current implementation of ExpiryTaskManager is causing issue GEODE-8535 and > some other related, not yet reported. > Also, as I am aware the project is moving away from ACE, so I'd say this is > the perfect oportunity to replace ExpiryTaskManager implementation. -- This message was sent by Atlassian Jira (v8.3.4#803005)