Skip to content

Commit 989e6a4

Browse files
committed
Remove GlobalCache
This is the fifth step in creating offline buildpacks. This change removes the GlobalCache as it will now, never be used. [#67852314]
1 parent 64970db commit 989e6a4

5 files changed

Lines changed: 4 additions & 106 deletions

File tree

docs/extending-caches.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Caches
2-
Many components will want to cache large files that are downloaded for applications. The buildpack provides a cache abstraction to encapsulate this caching behavior. The cache abstraction is comprised of three cache types each with the same signature.
2+
Many components will want to cache large files that are downloaded for applications. The buildpack provides a cache abstraction to encapsulate this caching behavior. The cache abstraction is comprised of two cache types each with the same signature.
33

44
```ruby
55
# Retrieves an item from the cache. Retrieval of the item uses the following algorithm:
@@ -48,7 +48,7 @@ Caching can be configured by modifying the [`config/cache.yml`][] file in the bu
4848
| `remote_downloads` | This property can take the value `enabled` or `disabled`. <p>The default value of `enabled` means that the buildpack will check the internet connection and remember the result for the remainder of the buildpack invocation. If the internet is available, it will then be used to download files. If the internet is not available, cache will be consulted instead. <p>Alternatively, the property may be set to `disabled` which avoids the check for an internet connection, does not attempt downloads, and consults the cache instead.
4949

5050
## `JavaBuildpack::Util::Cache::DownloadCache`
51-
The [`DownloadCache`][] is the most generic of the three caches. It allows you to create a cache that persists files any that write access is available. The constructor signature looks the following:
51+
The [`DownloadCache`][] is the most generic of the two caches. It allows you to create a cache that persists files any that write access is available. The constructor signature looks the following:
5252

5353
```ruby
5454
# Creates an instance of the cache that is backed by the filesystem rooted at +cache_root+
@@ -68,19 +68,7 @@ The [`ApplicationCache`][] is a cache that persists files into the application c
6868
def initialize
6969
```
7070

71-
## `JavaBuildpack::Util::Cache::GlobalCache`
72-
The [`GlobalCache`][] is a cache that persists files into the global cache passed to all scripts. It examines `ENV['BUILDPACK_CACHE']` for the cache location and configures itself accordingly.
73-
74-
```ruby
75-
# Creates an instance that is configured to use the global cache. The global cache location is defined by the
76-
# +BUILDPACK_CACHE+ environment variable
77-
#
78-
# @raise if the +BUILDPACK_CACHE+ environment variable is +nil+
79-
def initialize
80-
```
81-
8271
[`ApplicationCache`]: ../lib/java_buildpack/util/cache/application_cache.rb
8372
[`config/cache.yml`]: ../config/cache.yml
8473
[`DownloadCache`]: ../lib/java_buildpack/util/cache/download_cache.rb
85-
[`GlobalCache`]: ../lib/java_buildpack/util/cache/global_cache.rb
8674
[Configuration and Extension]: ../README.md#configuration-and-extension

lib/java_buildpack/component/base_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def download(version, uri, name = @component_name, &block)
8686
download_start_time = Time.now
8787
print "-----> Downloading #{name} #{version} from #{uri} "
8888

89-
JavaBuildpack::Util::Cache::ApplicationCache.new.get(uri) do |file| # TODO: Use global cache #50175265
89+
JavaBuildpack::Util::Cache::ApplicationCache.new.get(uri) do |file|
9090
puts "(#{(Time.now - download_start_time).duration})"
9191
yield file
9292
end

lib/java_buildpack/repository/repository_index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def initialize(repository_root)
3737
@default_repository_root = JavaBuildpack::Util::ConfigurationUtils.load('repository')['default_repository_root']
3838
.chomp('/')
3939

40-
JavaBuildpack::Util::Cache::DownloadCache.new.get("#{canonical repository_root}#{INDEX_PATH}") do |file| # TODO: Use global cache #50175265
40+
JavaBuildpack::Util::Cache::DownloadCache.new.get("#{canonical repository_root}#{INDEX_PATH}") do |file|
4141
@index = YAML.load_file(file)
4242
@logger.debug { @index }
4343
end

lib/java_buildpack/util/cache/global_cache.rb

Lines changed: 0 additions & 42 deletions
This file was deleted.

spec/java_buildpack/util/cache/global_cache_spec.rb

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)