diff --git a/src/fru_reader.cpp b/src/fru_reader.cpp
new file mode 100644
index 0000000..e381e7e
--- /dev/null
+++ b/src/fru_reader.cpp
@@ -0,0 +1,90 @@
+/*
+// Copyright (c) 2022 Equinix, Inc.
+//
+// Licensed 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 "fru_reader.hpp"
+
+#include <cstring>
+
+ssize_t FRUReader::read(off_t start, size_t len, uint8_t* outbuf)
+{
+    size_t done = 0;
+    size_t remaining = len;
+    size_t cursor = start;
+    while (done < len)
+    {
+        if (eof.has_value() && cursor >= eof.value())
+        {
+            break;
+        }
+
+        const uint8_t* blkData;
+        size_t available;
+        size_t blk = cursor / cacheBlockSize;
+        size_t blkOffset = cursor % cacheBlockSize;
+        auto findBlk = cache.find(blk);
+        if (findBlk == cache.end())
+        {
+            // miss, populate cache
+            uint8_t* newData = cache[blk].data();
+            int64_t ret =
+                readFunc(blk * cacheBlockSize, cacheBlockSize, newData);
+
+            // if we've reached the end of the eeprom, record its size
+            if (ret >= 0 && static_cast<size_t>(ret) < cacheBlockSize)
+            {
+                eof = (blk * cacheBlockSize) + ret;
+            }
+
+            if (ret <= 0)
+            {
+                // don't leave empty blocks in the cache
+                cache.erase(blk);
+                return done ? done : ret;
+            }
+
+            blkData = newData;
+            available = ret;
+        }
+        else
+        {
+            // hit, use cached data
+            blkData = findBlk->second.data();
+
+            // if the hit is to the block containing the (previously
+            // discovered on the miss that populated it) end of the eeprom,
+            // don't copy spurious bytes past the end
+            if (eof.has_value() && (eof.value() / cacheBlockSize == blk))
+            {
+                available = eof.value() % cacheBlockSize;
+            }
+            else
+            {
+                available = cacheBlockSize;
+            }
+        }
+
+        size_t toCopy = (blkOffset >= available)
+                            ? 0
+                            : std::min(available - blkOffset, remaining);
+
+        memcpy(outbuf + done, blkData + blkOffset, toCopy);
+        cursor += toCopy;
+        done += toCopy;
+        remaining -= toCopy;
+    }
+
+    return done;
+}
