Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 82A2F2009FB for ; Fri, 6 May 2016 17:54:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 81528160A0C; Fri, 6 May 2016 15:54:59 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F04A11608F8 for ; Fri, 6 May 2016 17:54:58 +0200 (CEST) Received: (qmail 65434 invoked by uid 500); 6 May 2016 15:54:58 -0000 Mailing-List: contact dev-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list dev@cloudstack.apache.org Received: (qmail 65423 invoked by uid 99); 6 May 2016 15:54:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2016 15:54:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6DE02DFC7E; Fri, 6 May 2016 15:54:57 +0000 (UTC) From: DaanHoogland To: dev@cloudstack.apache.org Reply-To: dev@cloudstack.apache.org References: In-Reply-To: Subject: [GitHub] cloudstack pull request: DAO: Hit the cache for entity flagged as ... Content-Type: text/plain Message-Id: <20160506155457.6DE02DFC7E@git1-us-west.apache.org> Date: Fri, 6 May 2016 15:54:57 +0000 (UTC) archived-at: Fri, 06 May 2016 15:54:59 -0000 Github user DaanHoogland commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1532#discussion_r62349471 --- Diff: framework/db/src/com/cloud/utils/db/GenericDaoBase.java --- @@ -969,7 +969,12 @@ public T findByUuidIncludingRemoved(final String uuid) { @Override @DB() public T findByIdIncludingRemoved(ID id) { - return findById(id, true, null); + if (_cache != null) { + final Element element = _cache.get(id); + return element == null ? findById(id, true, null) : (T)element.getObjectValue(); + } else { --- End diff -- yes, but I think the submitted code suggest it is optional: ``` T result = findById(id, true, null) if (_cache != null) { final Element element = _cache.get(id); if (element != null) { result = (T)element.getObjectValue(); } } return result; ``` I have no problem with the proposed code if _cache is optional however. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---