bowerphp
bowerphp copied to clipboard
"real" cache
Currently, we rely on Guzzle http cache. We should implement a "real" cache layer: if a package is in cache, we should not hit the http layer, but instead installa package from cache. Also, we need to implement "cache" command (list cached packages and clear cache).
I don't know if it is related, but I noticed that Bowerphp on my machine with windows is saving cache in folder D:/.cache/bowerphp (I'm running it on D drive). I'd prefer if system temporary dir was used, like in Composer, Doctrine, etc. The later one is using sys_get_temp_dir function.
See https://github.com/Bee-Lab/bowerphp/blob/master/src/Bowerphp/Config/Config.php#L41
@piotr-cz unfortunately windows systems are not available to any current developer of this project. Looks like composer is using getenv('APPDATA'), can you tell me where you composer cache is located?
getenv('APPDATA') evaluates on my system to C:\Users\piotr\AppData\Roaming and composer uses own subfolder here for storing vendor libraries that are installed globally.
MSDN specifies the roaming folder as
Windows uses the Roaming folder for application specific data, such as custom dictionaries, which are machine independent and should roam with the user profile.
getenv('LOCALAPPDATA') evaluates to C:\Users\piotr\AppData\Local, this is where composer stores cached files repos.,
sys_get_temp_dir() evaluates to C:\users\piotr\AppData\Local\Temp which is windows the garbage. User can easily delete it's contents using system clean tool.
at this moment cache assets are saved on C:\Users\[username]\.cache\bowerphp.
thanks, this is better
@garak how you think it should be implemented?
My proposition is should look like is in bower.
bower
├── packages
│ ├── 76825ba06db421bbfbda0853e440b3f5
│ │ └── 3.0.0
│ └── fe2fe255e91d251051d543998aa8327a
│ ├── 1.10.0
│ ├── 2.1.1
│ └── 2.1.1-rc2
└── registry
I read bower code and hashes are generated from repo url eg. git://github.com/twbs/bootstrap.git by the md5 function - we can do this in the same way.
Or maybe we should use bower cached files?
Now that Bowerphp is not relying on raw Guzzle anymore, we can use github-api cache.