Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MethodSource.clear_cache #73

Merged
merged 1 commit into from
Nov 17, 2021
Merged

Conversation

yhirano55
Copy link
Contributor

We often need to clear cache.

For example, in web application development, when we changed source code, we would like the change applied to the app server without reboot.

In the case of a Rails application, this requires the following configuration:

Rails.application.configure do
  config.to_prepare do
    MethodSource.instance_variable_set(:@lines_for_file, {})
  end
end

It seems so ugly, isn't it? So I feel we need to add MethodSource.clear_cache interface.

  Rails.application.configure do
    config.to_prepare do
-     MethodSource.instance_variable_set(:@lines_for_file, {})
+     MethodSource.clear_cache
    end
  end

We often need to clear cache.

For example, in web application development, when we changed source code, we would like the change applied to the app server without reboot.

In the case of a Rails application, this requires the following configuration:

```ruby
Rails.application.configure do
  config.to_prepare do
    MethodSource.instance_variable_set(:@lines_for_file, {})
  end
end
```

It seems so ugly, isn't it? So I feel we need to add `MethodSource.clear_cache` interface.

```diff
  Rails.application.configure do
    config.to_prepare do
-     MethodSource.instance_variable_set(:@lines_for_file, {})
+     MethodSource.clear_cache
    end
  end
```
@banister
Copy link
Owner

LGTM 🚢

@banister banister merged commit 81d039c into banister:master Nov 17, 2021
@yhirano55 yhirano55 deleted the cache_clearable branch November 17, 2021 05:02
@awfulcooking
Copy link

\o/ please release this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants