 
 public struct ImageRep {
     
-    fileprivate let base: ImageRepBase
+    private let base: ImageRepBase
+    
+    private let cache = Cache()
     
     private init(base: ImageRepBase) {
         self.base = base
+    }
+}
+
+extension ImageRep {
+    
+    @usableFromInline
+    class Cache {
+        
+        let lck = SDLock()
+        
+        var images: [MappedBufferOption: AnyImage]
+        var pages: [Int: ImageRep]
+        
+        @usableFromInline
+        init() {
+            self.images = [:]
+            self.pages = [:]
+        }
     }
 }
 

    
    public func representation(using storageType: MediaType, properties: [PropertyKey : Any]) -> Data? {
        
        let image = base as? AnyImage ?? base.image(option: .fileBacked)
        guard image.width > 0 && image.height > 0 else { return nil }
        
        let Encoder: ImageRepEncoder.Type

extension AnyImage {
    
    public init(imageRep: ImageRep, option: MappedBufferOption = .default) {
        self = imageRep.image(option: option)
    }
    
    public init(data: Data, option: MappedBufferOption = .default) throws {
        self = try ImageRep(data: data).image(option: option)
    }
}

