@Override
    public void put(Key key, Writer writer) {
        String safeKey = safeKeyGenerator.getSafeKey(key);
        writeLocker.acquire(key);
        try {
            DiskLruCache.Editor editor = getDiskCache().edit(safeKey);
            // Editor will be null if there are two concurrent puts. In the worst case we will just silently fail.
            if (editor != null) {
                try {
                    File file = editor.getFile(0);
                    if (writer.write(file)) {
                        editor.commit();
                    }
                } finally {
                    editor.abortUnlessCommitted();
                }
            }
        } catch (IOException e) {
            if (Log.isLoggable(TAG, Log.WARN)) {
                Log.w(TAG, "Unable to put to disk cache", e);
            }
        } finally {
            writeLocker.release(key);
        }
    }
Get a DiskCache in the given directory and size. If a disk cache has alread been created with
a different directory and/or size, it will be returned instead and the new arguments
will be ignored.

@param directory The directory for the disk cache
@param maxSize The max size for the disk cache
@return The new disk cache with the given arguments, or the current cache if one already exists
core/src/main/java/com/bumptech/glide/load/engine/cache/DiskLruCacheWrapper.java