Repository: activeloopai/deeplake

Issue:
Caching fails on windows with s3://
### Describe the issue

Caching path fails on windows

```python3
import hub
ds = hub.load("eurosat/eurosat-rgb") # is not loaded
```

Error shown
```
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\Folder/.activeloop/cache/s3:'
```

Likely caused by converting Linux style paths to windows.


Discussion:
Hello, I am unable to reproduce the issue at my end

```
import hub

ds = hub.load("eurosat/eurosat-rgb")

print("Dataset Loaded..")

print("Dataset keys: \n", ds.keys)
print("\nTensorView: \n", ds["image", 0])
```

Output:
![image](https://user-images.githubusercontent.com/39651310/99972048-0f643f00-2dc4-11eb-809f-8da0b75f51ef.png)



@calebjuma27 can you please give us more information here as well to reproduce the issue on our side?

@ADI10HERO Another issue from @calebjuma27 was found in this environment.
```
Windows Version: Microsoft Windows 10 Home
Python Version 3.7.8
```



Resolving patch:
diff --git a/hub/store/lru_cache.py b/hub/store/lru_cache.py
--- a/hub/store/lru_cache.py
+++ b/hub/store/lru_cache.py
@@ -3,25 +3,10 @@
 
 # from multiprocessing import Lock
 
-import fcntl
 import hashlib
 import uuid
 
 
-class SystemMutex:
-    def __init__(self, name=str(uuid.uuid4())):
-        self.name = name
-        self._lockid = hashlib.sha1(self.name.encode("utf8")).hexdigest()
-
-    def __enter__(self):
-        self.fp = open(f"/tmp/.lock-{self._lockid}.lck", "wb")
-        fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX)
-
-    def __exit__(self, _type, value, tb):
-        fcntl.flock(self.fp.fileno(), fcntl.LOCK_UN)
-        self.fp.close()
-
-
 class DummyLock:
     def __init__(self):
         pass
diff --git a/hub/store/store.py b/hub/store/store.py
--- a/hub/store/store.py
+++ b/hub/store/store.py
@@ -96,9 +96,32 @@ def _get_storage_map(fs, path):
     return StorageMapWrapperWithCommit(fs.get_mapper(path, check=False, create=False))
 
 
+def get_cache_path(path, cache_folder="~/.activeloop/cache/"):
+    if (
+        path.startswith("s3://")
+        or path.startswith("gcs://")
+    ):
+        path = '//'.join(path.split("//")[1:])
+    elif (
+        path.startswith("../")
+        or path.startswith("./")
+        or path.startswith("/")
+        or path.startswith("~/")
+    ):
+        path = "/".join(path.split("/")[1:])
+    elif path.find("://") != -1:
+        path = path.split("://")[-1]
+    elif path.find(":\\") != -1:
+        path = path.split(":\\")[-1]
+    else:
+        # path is username/dataset or username/dataset:version
+        path = path.replace(':', '/')
+    return os.path.expanduser(posixpath.join(cache_folder, path))
+
+
 def get_storage_map(fs, path, memcache=2 ** 26, lock=True, storage_cache=2 ** 28):
     store = _get_storage_map(fs, path)
-    cache_path = posixpath.expanduser(posixpath.join("~/.activeloop/cache/", path))
+    cache_path = get_cache_path(path)
     if storage_cache and storage_cache > 0:
         os.makedirs(cache_path, exist_ok=True)
         store = LRUCache(


Test patch:
diff --git a/hub/store/tests/test_store.py b/hub/store/tests/test_store.py
new file mode 100644
--- /dev/null
+++ b/hub/store/tests/test_store.py
@@ -0,0 +1,16 @@
+from hub.store.store import get_cache_path
+
+
+def test_get_cache_path():
+    cache_folder = './cache/'
+    assert "./cache/test/testdb" == get_cache_path('s3://test/testdb', cache_folder)      
+    assert "./cache/test/testdb" == get_cache_path('gcs://test/testdb', cache_folder)
+    assert "./cache/test/testdb" == get_cache_path('test/testdb', cache_folder)
+    assert "./cache/test/testdb" == get_cache_path('https://test/testdb', cache_folder)
+    assert "./cache/test/testdb" == get_cache_path('~/test/testdb', cache_folder)
+    assert "./cache/test/testdb" == get_cache_path('/test/testdb', cache_folder)
+    assert "./cache/test\\testdb" == get_cache_path('C:\\test\\testdb', cache_folder)
+
+
+if __name__ == "__main__":
+    test_get_cache_path()