diff --git a/src/lp/cache-policy.cpp b/src/lp/cache-policy.cpp
new file mode 100644
index 0000000..6bd1be9
--- /dev/null
+++ b/src/lp/cache-policy.cpp
@@ -0,0 +1,139 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ *
+ * @author Eric Newberry <enewberry@email.arizona.edu>
+ */
+
+#include "cache-policy.hpp"
+
+namespace ndn {
+namespace lp {
+
+std::ostream&
+operator<<(std::ostream& os, CachePolicyType policy)
+{
+  switch (policy) {
+  case CachePolicyType::NO_CACHE:
+    os << "NoCache";
+    break;
+  default:
+    os << "None";
+    break;
+  }
+
+  return os;
+}
+
+CachePolicy::CachePolicy()
+  : m_policy(CachePolicyType::NONE)
+{
+}
+
+CachePolicy::CachePolicy(const Block& block)
+{
+  wireDecode(block);
+}
+
+template<encoding::Tag TAG>
+size_t
+CachePolicy::wireEncode(EncodingImpl<TAG>& encoder) const
+{
+  if (m_policy == CachePolicyType::NONE) {
+    throw Error("CachePolicyType must be set");
+  }
+  size_t length = 0;
+  length += prependNonNegativeIntegerBlock(encoder, tlv::CachePolicyType,
+                                           static_cast<uint32_t>(m_policy));
+  length += encoder.prependVarNumber(length);
+  length += encoder.prependVarNumber(tlv::CachePolicy);
+  return length;
+}
+
+template size_t
+CachePolicy::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
+
+template size_t
+CachePolicy::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
+
+const Block&
+CachePolicy::wireEncode() const
+{
+  if (m_policy == CachePolicyType::NONE) {
+    throw Error("CachePolicyType must be set");
+  }
+
+  if (m_wire.hasWire()) {
+    return m_wire;
+  }
+
+  EncodingEstimator estimator;
+  size_t estimatedSize = wireEncode(estimator);
+
+  EncodingBuffer buffer(estimatedSize, 0);
+  wireEncode(buffer);
+
+  m_wire = buffer.block();
+
+  return m_wire;
+}
+
+void
+CachePolicy::wireDecode(const Block& wire)
+{
+  if (wire.type() != tlv::CachePolicy) {
+    throw Error("expecting CachePolicy block");
+  }
+
+  m_wire = wire;
+  m_wire.parse();
+
+  Block::element_const_iterator it = m_wire.elements_begin();
+  if (it != m_wire.elements_end() && it->type() == tlv::CachePolicyType) {
+    m_policy = static_cast<CachePolicyType>(readNonNegativeInteger(*it));
+    if (this->getPolicy() == CachePolicyType::NONE) {
+      throw Error("unknown CachePolicyType");
+    }
+  }
+  else {
+    throw Error("expecting CachePolicyType block");
+  }
+}
+
+CachePolicyType
+CachePolicy::getPolicy() const
+{
+  switch (m_policy) {
+  case CachePolicyType::NO_CACHE:
+    return m_policy;
+  default:
+    return CachePolicyType::NONE;
+  }
+}
+
+CachePolicy&
+CachePolicy::setPolicy(CachePolicyType policy)
+{
+  m_policy = policy;
+  m_wire.reset();
+  return *this;
+}
+
+} // namespace lp
+} // namespace ndn
diff --git a/src/lp/cache-policy.hpp b/src/lp/cache-policy.hpp
new file mode 100644
index 0000000..a67a9c3
--- /dev/null
+++ b/src/lp/cache-policy.hpp
@@ -0,0 +1,112 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ *
+ * @author Eric Newberry <enewberry@email.arizona.edu>
+ */
+
+#ifndef NDN_CXX_LP_CACHE_POLICY_HPP
+#define NDN_CXX_LP_CACHE_POLICY_HPP
+
+#include "../common.hpp"
+#include "../encoding/encoding-buffer.hpp"
+#include "../encoding/block-helpers.hpp"
+
+#include "tlv.hpp"
+
+namespace ndn {
+namespace lp {
+
+/**
+ * \brief indicates the cache policy applied to a Data packet
+ */
+enum class CachePolicyType {
+  NONE = 0,
+  NO_CACHE = 1
+};
+
+std::ostream&
+operator<<(std::ostream& os, CachePolicyType policy);
+
+/**
+ * \brief represents a CachePolicy header field
+ */
+class CachePolicy
+{
+public:
+  class Error : public ndn::tlv::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : ndn::tlv::Error(what)
+    {
+    }
+  };
+
+  CachePolicy();
+
+  explicit
+  CachePolicy(const Block& block);
+
+  /**
+   * \brief prepend CachePolicy to encoder
+   * \pre getPolicy() != CachePolicyType::NONE
+   * \throw Error policy type is unset
+   */
+  template<encoding::Tag TAG>
+  size_t
+  wireEncode(EncodingImpl<TAG>& encoder) const;
+
+  /**
+   * \brief encode CachePolicy into wire format
+   */
+  const Block&
+  wireEncode() const;
+
+  /**
+   * \brief get CachePolicyType from wire format
+   */
+  void
+  wireDecode(const Block& wire);
+
+public: // policy type
+  /**
+   * \return policy type code
+   * \retval CachePolicyType::NONE if policy type is unset or has an unknown code
+   */
+  CachePolicyType
+  getPolicy() const;
+
+  /**
+   * \brief set policy type code
+   * \param policy a policy type code; CachePolicyType::NONE clears the policy
+   */
+  CachePolicy&
+  setPolicy(CachePolicyType policy);
+
+private:
+  CachePolicyType m_policy;
+  mutable Block m_wire;
+};
+
+} // namespace lp
+} // namespace ndn
+
+#endif // NDN_CXX_LP_CACHE_POLICY_HPP
\ No newline at end of file
diff --git a/tests/unit-tests/lp/cache-policy.t.cpp b/tests/unit-tests/lp/cache-policy.t.cpp
new file mode 100644
index 0000000..8d249dc
--- /dev/null
+++ b/tests/unit-tests/lp/cache-policy.t.cpp
@@ -0,0 +1,104 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ *
+ * @author Eric Newberry <enewberry@email.arizona.edu>
+ */
+
+#include "lp/cache-policy.hpp"
+
+#include "boost-test.hpp"
+
+namespace ndn {
+namespace lp {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(LpCachePoicy)
+
+BOOST_AUTO_TEST_CASE(Encode)
+{
+  CachePolicy policy;
+  policy.setPolicy(CachePolicyType::NO_CACHE);
+
+  Block wire;
+  BOOST_REQUIRE_NO_THROW(wire = policy.wireEncode());
+
+  // Sample encoded value obtained with:
+  // for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+  //   printf("0x%02x, ", *it);
+  // }
+
+  // Contains CachePolicyType::NO_CACHE
+  static const uint8_t expectedBlock[] = {
+    0xfd, 0x03, 0x34, 0x05, 0xfd, 0x03, 0x35, 0x01, 0x01
+  };
+
+  BOOST_CHECK_EQUAL_COLLECTIONS(expectedBlock, expectedBlock + sizeof(expectedBlock),
+                                wire.begin(), wire.end());
+
+  BOOST_REQUIRE_NO_THROW(policy.wireDecode(wire));
+}
+
+BOOST_AUTO_TEST_CASE(DecodeUnknownPolicyError)
+{
+  static const uint8_t expectedBlock[] = {
+    0xfd, 0x03, 0x34, 0x08, 0xfd, 0x03, 0x35, 0x04, 0xff, 0xff, 0xff, 0xff
+  };
+
+  CachePolicy policy;
+  Block wire(expectedBlock, sizeof(expectedBlock));
+  BOOST_REQUIRE_THROW(policy.wireDecode(wire), CachePolicy::Error);
+}
+
+BOOST_AUTO_TEST_CASE(DecodeMissingPolicyError)
+{
+  static const uint8_t inputBlock[] = {
+    0xfd, 0x03, 0x34, 0x00
+  };
+
+  CachePolicy policy;
+  Block wire(inputBlock, sizeof(inputBlock));
+  BOOST_REQUIRE_THROW(policy.wireDecode(wire), CachePolicy::Error);
+}
+
+BOOST_AUTO_TEST_CASE(DecodeInvalidPolicyError)
+{
+  static const uint8_t inputBlock[] = {
+    0xfd, 0x03, 0x34, 0x05, 0xfd, 0x03, 0x35, 0x01, 0x00
+  };
+
+  CachePolicy policy;
+  Block wire(inputBlock, sizeof(inputBlock));
+  BOOST_REQUIRE_THROW(policy.wireDecode(wire), CachePolicy::Error);
+}
+
+BOOST_AUTO_TEST_CASE(Policy)
+{
+  CachePolicy policy;
+  BOOST_CHECK_EQUAL(policy.getPolicy(), CachePolicyType::NONE);
+
+  policy.setPolicy(CachePolicyType::NO_CACHE);
+  BOOST_CHECK_EQUAL(policy.getPolicy(), CachePolicyType::NO_CACHE);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace lp
+} // namespace ndn
\ No newline at end of file
