We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docs/examples/stores/registry_configure_integrations.py`
Content:
```
1 from pathlib import Path
2 
3 from starlite import Starlite
4 from starlite.middleware.session.server_side import ServerSideSessionConfig
5 from starlite.stores.file import FileStore
6 from starlite.stores.redis import RedisStore
7 
8 app = Starlite(
9     stores={
10         "sessions": RedisStore.with_client(),
11         "request_cache": FileStore(Path("request-cache")),
12     },
13     middleware=[ServerSideSessionConfig().middleware],
14 )
15
```

Path: `starlite/config/response_cache.py`
Content:
```
1 from __future__ import annotations
2 
3 from dataclasses import dataclass, field
4 from typing import TYPE_CHECKING, Any
5 from urllib.parse import urlencode
6 
7 __all__ = ("ResponseCacheConfig", "default_cache_key_builder")
8 
9 
10 if TYPE_CHECKING:
11     from starlite import Starlite
12     from starlite.connection import Request
13     from starlite.stores.base import Store
14     from starlite.types import CacheKeyBuilder
15 
16 
17 def default_cache_key_builder(request: Request[Any, Any, Any]) -> str:
18     """Given a request object, returns a cache key by combining the path with the sorted query params.
19 
20     Args:
21         request: request used to generate cache key.
22 
23     Returns:
24         A combination of url path and query parameters
25     """
26     query_params: list[tuple[str, Any]] = list(request.query_params.dict().items())
27     query_params.sort(key=lambda x: x[0])
28     return request.url.path + urlencode(query_params, doseq=True)
29 
30 
31 @dataclass
32 class ResponseCacheConfig:
33     """Configuration for response caching.
34 
35     To enable response caching, pass an instance of this class to :class:`Starlite <.app.Starlite>` using the
36     ``response_cache_config`` key.
37     """
38 
39     default_expiration: int = field(default=60)
40     """Default cache expiration in seconds."""
41     key_builder: CacheKeyBuilder = field(default=default_cache_key_builder)
42     """:class:`CacheKeyBuilder <.types.CacheKeyBuilder>`. Defaults to :func:`default_cache_key_builder`."""
43     store: str = "request_cache"
44     """Name of the :class:`Store <.stores.base.Store>` to use."""
45 
46     def get_store_from_app(self, app: Starlite) -> Store:
47         """Get the store defined in :attr:`store` from an :class:`Starlite <.app.Starlite>` instance."""
48         return app.stores.get(self.store)
49
```

Path: `docs/examples/stores/registry_default_factory_namespacing.py`
Content:
```
1 from starlite import Starlite, get
2 from starlite.middleware.rate_limit import RateLimitConfig
3 from starlite.middleware.session.server_side import ServerSideSessionConfig
4 from starlite.stores.redis import RedisStore
5 from starlite.stores.registry import StoreRegistry
6 
7 root_store = RedisStore.with_client()
8 
9 
10 @get(cache=True)
11 def cached_handler() -> str:
12     # this will use app.stores.get("request_cache")
13     return "Hello, world!"
14 
15 
16 app = Starlite(
17     [cached_handler],
18     stores=StoreRegistry(default_factory=root_store.with_namespace),
19     middleware=[
20         RateLimitConfig(("second", 1)).middleware,
21         ServerSideSessionConfig().middleware,
22     ],
23 )
24
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/docs/examples/stores/registry_configure_integrations.py b/docs/examples/stores/registry_configure_integrations.py
--- a/docs/examples/stores/registry_configure_integrations.py
+++ b/docs/examples/stores/registry_configure_integrations.py
@@ -8,7 +8,7 @@
 app = Starlite(
     stores={
         "sessions": RedisStore.with_client(),
-        "request_cache": FileStore(Path("request-cache")),
+        "response_cache": FileStore(Path("response-cache")),
     },
     middleware=[ServerSideSessionConfig().middleware],
 )
diff --git a/docs/examples/stores/registry_default_factory_namespacing.py b/docs/examples/stores/registry_default_factory_namespacing.py
--- a/docs/examples/stores/registry_default_factory_namespacing.py
+++ b/docs/examples/stores/registry_default_factory_namespacing.py
@@ -9,7 +9,7 @@
 
 @get(cache=True)
 def cached_handler() -> str:
-    # this will use app.stores.get("request_cache")
+    # this will use app.stores.get("response_cache")
     return "Hello, world!"
 
 
diff --git a/starlite/config/response_cache.py b/starlite/config/response_cache.py
--- a/starlite/config/response_cache.py
+++ b/starlite/config/response_cache.py
@@ -40,7 +40,7 @@
     """Default cache expiration in seconds."""
     key_builder: CacheKeyBuilder = field(default=default_cache_key_builder)
     """:class:`CacheKeyBuilder <.types.CacheKeyBuilder>`. Defaults to :func:`default_cache_key_builder`."""
-    store: str = "request_cache"
+    store: str = "response_cache"
     """Name of the :class:`Store <.stores.base.Store>` to use."""
 
     def get_store_from_app(self, app: Starlite) -> Store:

{"golden_diff": "diff --git a/docs/examples/stores/registry_configure_integrations.py b/docs/examples/stores/registry_configure_integrations.py\n--- a/docs/examples/stores/registry_configure_integrations.py\n+++ b/docs/examples/stores/registry_configure_integrations.py\n@@ -8,7 +8,7 @@\n app = Starlite(\n     stores={\n         \"sessions\": RedisStore.with_client(),\n-        \"request_cache\": FileStore(Path(\"request-cache\")),\n+        \"response_cache\": FileStore(Path(\"response-cache\")),\n     },\n     middleware=[ServerSideSessionConfig().middleware],\n )\ndiff --git a/docs/examples/stores/registry_default_factory_namespacing.py b/docs/examples/stores/registry_default_factory_namespacing.py\n--- a/docs/examples/stores/registry_default_factory_namespacing.py\n+++ b/docs/examples/stores/registry_default_factory_namespacing.py\n@@ -9,7 +9,7 @@\n \n @get(cache=True)\n def cached_handler() -> str:\n-    # this will use app.stores.get(\"request_cache\")\n+    # this will use app.stores.get(\"response_cache\")\n     return \"Hello, world!\"\n \n \ndiff --git a/starlite/config/response_cache.py b/starlite/config/response_cache.py\n--- a/starlite/config/response_cache.py\n+++ b/starlite/config/response_cache.py\n@@ -40,7 +40,7 @@\n     \"\"\"Default cache expiration in seconds.\"\"\"\n     key_builder: CacheKeyBuilder = field(default=default_cache_key_builder)\n     \"\"\":class:`CacheKeyBuilder <.types.CacheKeyBuilder>`. Defaults to :func:`default_cache_key_builder`.\"\"\"\n-    store: str = \"request_cache\"\n+    store: str = \"response_cache\"\n     \"\"\"Name of the :class:`Store <.stores.base.Store>` to use.\"\"\"\n \n     def get_store_from_app(self, app: Starlite) -> Store:\n", "issue": "StaticFilesConfig and virtual directories\nI'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. \r\n\r\nThis is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.\r\n\r\nhttps://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32\n", "before_files": [{"content": "from pathlib import Path\n\nfrom starlite import Starlite\nfrom starlite.middleware.session.server_side import ServerSideSessionConfig\nfrom starlite.stores.file import FileStore\nfrom starlite.stores.redis import RedisStore\n\napp = Starlite(\n    stores={\n        \"sessions\": RedisStore.with_client(),\n        \"request_cache\": FileStore(Path(\"request-cache\")),\n    },\n    middleware=[ServerSideSessionConfig().middleware],\n)\n", "path": "docs/examples/stores/registry_configure_integrations.py"}, {"content": "from __future__ import annotations\n\nfrom dataclasses import dataclass, field\nfrom typing import TYPE_CHECKING, Any\nfrom urllib.parse import urlencode\n\n__all__ = (\"ResponseCacheConfig\", \"default_cache_key_builder\")\n\n\nif TYPE_CHECKING:\n    from starlite import Starlite\n    from starlite.connection import Request\n    from starlite.stores.base import Store\n    from starlite.types import CacheKeyBuilder\n\n\ndef default_cache_key_builder(request: Request[Any, Any, Any]) -> str:\n    \"\"\"Given a request object, returns a cache key by combining the path with the sorted query params.\n\n    Args:\n        request: request used to generate cache key.\n\n    Returns:\n        A combination of url path and query parameters\n    \"\"\"\n    query_params: list[tuple[str, Any]] = list(request.query_params.dict().items())\n    query_params.sort(key=lambda x: x[0])\n    return request.url.path + urlencode(query_params, doseq=True)\n\n\n@dataclass\nclass ResponseCacheConfig:\n    \"\"\"Configuration for response caching.\n\n    To enable response caching, pass an instance of this class to :class:`Starlite <.app.Starlite>` using the\n    ``response_cache_config`` key.\n    \"\"\"\n\n    default_expiration: int = field(default=60)\n    \"\"\"Default cache expiration in seconds.\"\"\"\n    key_builder: CacheKeyBuilder = field(default=default_cache_key_builder)\n    \"\"\":class:`CacheKeyBuilder <.types.CacheKeyBuilder>`. Defaults to :func:`default_cache_key_builder`.\"\"\"\n    store: str = \"request_cache\"\n    \"\"\"Name of the :class:`Store <.stores.base.Store>` to use.\"\"\"\n\n    def get_store_from_app(self, app: Starlite) -> Store:\n        \"\"\"Get the store defined in :attr:`store` from an :class:`Starlite <.app.Starlite>` instance.\"\"\"\n        return app.stores.get(self.store)\n", "path": "starlite/config/response_cache.py"}, {"content": "from starlite import Starlite, get\nfrom starlite.middleware.rate_limit import RateLimitConfig\nfrom starlite.middleware.session.server_side import ServerSideSessionConfig\nfrom starlite.stores.redis import RedisStore\nfrom starlite.stores.registry import StoreRegistry\n\nroot_store = RedisStore.with_client()\n\n\n@get(cache=True)\ndef cached_handler() -> str:\n    # this will use app.stores.get(\"request_cache\")\n    return \"Hello, world!\"\n\n\napp = Starlite(\n    [cached_handler],\n    stores=StoreRegistry(default_factory=root_store.with_namespace),\n    middleware=[\n        RateLimitConfig((\"second\", 1)).middleware,\n        ServerSideSessionConfig().middleware,\n    ],\n)\n", "path": "docs/examples/stores/registry_default_factory_namespacing.py"}], "after_files": [{"content": "from pathlib import Path\n\nfrom starlite import Starlite\nfrom starlite.middleware.session.server_side import ServerSideSessionConfig\nfrom starlite.stores.file import FileStore\nfrom starlite.stores.redis import RedisStore\n\napp = Starlite(\n    stores={\n        \"sessions\": RedisStore.with_client(),\n        \"response_cache\": FileStore(Path(\"response-cache\")),\n    },\n    middleware=[ServerSideSessionConfig().middleware],\n)\n", "path": "docs/examples/stores/registry_configure_integrations.py"}, {"content": "from __future__ import annotations\n\nfrom dataclasses import dataclass, field\nfrom typing import TYPE_CHECKING, Any\nfrom urllib.parse import urlencode\n\n__all__ = (\"ResponseCacheConfig\", \"default_cache_key_builder\")\n\n\nif TYPE_CHECKING:\n    from starlite import Starlite\n    from starlite.connection import Request\n    from starlite.stores.base import Store\n    from starlite.types import CacheKeyBuilder\n\n\ndef default_cache_key_builder(request: Request[Any, Any, Any]) -> str:\n    \"\"\"Given a request object, returns a cache key by combining the path with the sorted query params.\n\n    Args:\n        request: request used to generate cache key.\n\n    Returns:\n        A combination of url path and query parameters\n    \"\"\"\n    query_params: list[tuple[str, Any]] = list(request.query_params.dict().items())\n    query_params.sort(key=lambda x: x[0])\n    return request.url.path + urlencode(query_params, doseq=True)\n\n\n@dataclass\nclass ResponseCacheConfig:\n    \"\"\"Configuration for response caching.\n\n    To enable response caching, pass an instance of this class to :class:`Starlite <.app.Starlite>` using the\n    ``response_cache_config`` key.\n    \"\"\"\n\n    default_expiration: int = field(default=60)\n    \"\"\"Default cache expiration in seconds.\"\"\"\n    key_builder: CacheKeyBuilder = field(default=default_cache_key_builder)\n    \"\"\":class:`CacheKeyBuilder <.types.CacheKeyBuilder>`. Defaults to :func:`default_cache_key_builder`.\"\"\"\n    store: str = \"response_cache\"\n    \"\"\"Name of the :class:`Store <.stores.base.Store>` to use.\"\"\"\n\n    def get_store_from_app(self, app: Starlite) -> Store:\n        \"\"\"Get the store defined in :attr:`store` from an :class:`Starlite <.app.Starlite>` instance.\"\"\"\n        return app.stores.get(self.store)\n", "path": "starlite/config/response_cache.py"}, {"content": "from starlite import Starlite, get\nfrom starlite.middleware.rate_limit import RateLimitConfig\nfrom starlite.middleware.session.server_side import ServerSideSessionConfig\nfrom starlite.stores.redis import RedisStore\nfrom starlite.stores.registry import StoreRegistry\n\nroot_store = RedisStore.with_client()\n\n\n@get(cache=True)\ndef cached_handler() -> str:\n    # this will use app.stores.get(\"response_cache\")\n    return \"Hello, world!\"\n\n\napp = Starlite(\n    [cached_handler],\n    stores=StoreRegistry(default_factory=root_store.with_namespace),\n    middleware=[\n        RateLimitConfig((\"second\", 1)).middleware,\n        ServerSideSessionConfig().middleware,\n    ],\n)\n", "path": "docs/examples/stores/registry_default_factory_namespacing.py"}]}