Remove type=”text/javascript” added by W3 Total Cache plugin

I added code to the functions.php file:

add_filter('script_loader_tag', 'js_atr', 10, 2); function js_atr($  tag, $  handle) {     return str_replace(array('type="text/javascript"', "type='text/javascript'"), '', $  tag); } 

After that, all text/javascript are disappeared, except those that add a plugin. It looks like this:

script src=”https://code.jquery.com/jquery-3.3.1.min.js”

script type=”text/javascript” src=”https://mydomain/files/cache/minify/65f03.js”

How to remove this type=”text/javascript”?

Browser cache not clearing regardless of meta tags

So, the problem is as follows. I am trying to make a small html page update to the latest version on server while it is loaded. I have gotten to the point where I am just trying to make this work, with a page as barebones as it can get. I have tried this on firefox, internet explorer and microsoft edge, all with the same results.

<html>  <head>  <meta http-equiv="cache-control" content="no-cache"> <!-- tells browser not to cache --> <meta http-equiv="expires" content="-1"> <!-- says that the cache expires 'now' --> <meta http-equiv="pragma" content="no-cache"> <!-- says not to use cached stuff, if there is any -->   </head>  <body> testing cache update - 4 </body>    </html> 

This is the entire sourcecode of the page, and no matter how i tweak the meta tags, i -always- have to hard reload with ctrl+f5 to get the latest version of the page (i tweak the text in body) to show up.

Does anyone have any idea what’s going on here, and how i can make my page always load the latest version?

How do I completely disable cache for a vue.js static app in nginx?

I’m using the following headers, but even with chrome devtools open and cache disabled, the content is still cached in the browser.

It is a compiled vue.js 2.x app.

Here are the nginx headers

HTTP/1.1 200 OK Server: nginx/1.14.0 (Ubuntu) Date: Sun, 20 Jan 2019 00:47:25 GMT Content-Type: text/html Content-Length: 3162 Connection: keep-alive Expires: Sun, 20 Jan 2019 00:47:24 GMT Cache-Control: no-cache Pragma: no-cache Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0 Accept-Ranges: bytes 

What am I doing wrong? The only way I can clear cache is to do it at the browser level which is annoying.

We do continuous deployment and caching is not desired.

It is the index.html page that loads all the assets which are hashed, but that index.html page is being cached in Chrome/Linux and Mac.

Simple local cache that checks by date else get from db

I’m looking for feedback on how this can be improved, basically what I’m trying to do is check if the cache has the object else check from the database.

I have list of ids, then I separate them based on if they already exist in the cache or not, based on the date as well. One list fetches from the cache, the other from the db. Then return the list. that way I don’t have to make multiple calls to cache/db.

The alternative is to implement a compound-key but I would rather not go that route

https://github.com/mel3kings/taxi-cab-api/blob/master/src/main/java/com/simple/controller/CabController.java

 private List<Cab> getFromCacheOrDb(CabTripsRequest request) {         Map<Boolean, List<String>> cachedCabs = request.getMedallions().stream().collect(                 partitioningBy(key -> {                     if (!cache.peek(key)) { return false; }                     return cache.get(key).stream().anyMatch(a -> a.getPickupDateTime().equals(request.getDate()));                 }));         List<Cab> response = cachedCabs.get(true).stream().map(k -> cache.get(k)).flatMap(List::stream)                 .filter(cab -> cab.getPickupDateTime().equals(request.getDate())).collect(toList());         if (cachedCabs.get(false).size() > 0) {             List<Cab> database = storage.fetch(cachedCabs.get(false), request.getDate());             response.addAll(database);             cache.save(database);         }         log.info("response from cache/db size:" + response.size());         return response;     } 

Clear region with menu’s per url cache

I have a region with menus, a menus displays depending on the url example if on the about page(sitename/about-us), display about menu and links as a sub menu.

It works, but the problem is after navigating through the site a couple of times, the region caches. is the anyway i can clear the regions cache on page reload.

I tried the below in my .theme

/** * Implements hook_preprocess_HOOK() for block.html.twig. */ function themename_preprocess_block(&$ vars) { the menu block id name in the region if($ vars[‘derivative_plugin_id’] == ‘submenu’) { //– This stops the block being cache in drupal 8 $ vars[‘#cache’][‘max-age’] = 0;

} }

also tried

/** * Implements hook_preprocess_HOOK() for block.html.twig. */ function themename_preprocess_block(&$ vars) {

if($ vars[‘derivative_plugin_id’] == ‘theme-block-branding’) { //– This stops the block being cache in drupal 8 $ vars[‘#cache’][‘max-age’] = 0;

} }

not sure what steps I can follow to achieve the above

Memory cache using ConcurrentDictionary

Based on internet samples I’ve tried to create a simple cache mechanism using ConcurrentDictionary assumptions: – it has to work in sync/async mode – it has to be updateable

Thank you in advance for any halp

    public class CacheStore<TValue> {     private readonly ConcurrentDictionary<string, TaskCompletionSource<TValue>> _sourceCache =         new ConcurrentDictionary<string, TaskCompletionSource<TValue>>();      public async Task<TValue> AddOrGetItemAsync(string key, Func<Task<TValue>> valueFactory)     {         var newSource = new TaskCompletionSource<TValue>();         var currentSource = _sourceCache.GetOrAdd(key, newSource);          if (currentSource != newSource)         {             return await currentSource.Task;         }          try         {             var result = await valueFactory();             newSource.SetResult(result);         }         catch (Exception e)         {             newSource.SetException(e);         }          return await newSource.Task;     }      public TValue AddOrGetItem(string key, Func<TValue> valueFactory)     {         var newSource = new TaskCompletionSource<TValue>();         var currentSource = _sourceCache.GetOrAdd(key, newSource);          if (currentSource != newSource)         {             return currentSource.Task.Result;         }          try         {             var result = valueFactory();             newSource.SetResult(result);         }         catch (Exception e)         {             newSource.SetException(e);         }          return newSource.Task.Result;     }      public bool TryUpdateItem(string key, TValue value)     {         try         {             var newSource = new TaskCompletionSource<TValue>();             newSource.SetResult(value);              _sourceCache[key] = newSource;         }         catch (KeyNotFoundException)         {             return false;         }         catch (ArgumentNullException)         {             return false;         }          return true;     } } 

What’s the difference between cache miss penalty and latency to memory?

Can I say that cache miss penalty includes latency to memory? My current understanding is that cache miss penalty is the time moving data from the layer closer to main memory to it. But I’m not sure about what’s the meaning of latency to memory? If they’re not the same what’s the overlapping part?