interest: Cache Link object after the first call to getLink

Change-Id: I2625cdb665365cb3c1a69ec7d917d09ad621988d
Refs: #3158
diff --git a/src/interest.hpp b/src/interest.hpp
index 80a1b18..686f0a0 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -134,8 +134,9 @@
    * @brief Get the link object for this interest
    * @return The link object if there is one contained in this interest
    * @throws Interest::Error if there is no link object contained in the interest
+   * @throws tlv::Error if the incorporated link object is malformed
    */
-  Link
+  const Link&
   getLink() const;
 
   /**
@@ -147,7 +148,8 @@
   setLink(const Block& link);
 
   /**
-   *@brief Reset the wire format of the given interest and the contained link
+   * @brief Delete the link object for this interest
+   * @post !hasLink()
    */
   void
   unsetLink();
@@ -442,6 +444,7 @@
   time::milliseconds m_interestLifetime;
 
   mutable Block m_link;
+  mutable shared_ptr<Link> m_linkCached;
   size_t m_selectedDelegationIndex;
   mutable Block m_wire;