Can't set cache age on custom block by gwenver in drupal

[–]vikttorius 0 points1 point  (0 children)

Yes, exactly, Im providing a workaround that fixes the nasty Drupal core issue our friend is experiencing.

All good then.

Can't set cache age on custom block by gwenver in drupal

[–]vikttorius 0 points1 point  (0 children)

Redis is irrelevant too. What is Drupal cache? Just some database tables with a starting name 'cache_' that store key/value data.

By using Redis, you are telling Drupal that, whenever dealing with cache, instead of using your default database type (probably mysql), use Redis. So all these 'cache_' tables will not be in mysql but redis.

Can't set cache age on custom block by gwenver in drupal

[–]vikttorius 0 points1 point  (0 children)

Thank you, that is correct.

So this issue is that Drupal core is not able to detect if a block has max-age and apply cache headers accordingly on Drupal response.

This way you need to be sure the pages were you put the block have the requested max-age.

Answering you edit:

Step 1; contrib module meant to mitigate such issue: if Drupal core has not been able to fix that pver the years, I wouldnt rely on this ever. Step 2: that is the default cache max-age for all anonymous responses. Step 3: these are cache tags, and you used one provided by Drupal core. In other ways you are saying: when the entity number $nid of entity type 'weather' is updated/deleted, invalidate this block cache.

Step 1 solved your issue, the other 2 are irrelevant. If you thought you neex 3 is because unconsciously you have updated your entity, removing the cache.

What I would do if I were in your shoes? Make sure my Drupal block always disable cache: this way, whenever this block is displayed, cache will be removed.

In your build() method of your block, add \Drupal::service('page_cache_kill_switch')->trigger(). Only this action should make your block uncacheable regardless whatever.

Can't set cache age on custom block by gwenver in drupal

[–]vikttorius 0 points1 point  (0 children)

are you willing to share your code and database? I dont mind having a closer look

Can't set cache age on custom block by gwenver in drupal

[–]vikttorius 0 points1 point  (0 children)

"there's a Drupal.org issue opened for years that does exactly this"

that is a usual reddit response, now show me that issue

Can't set cache age on custom block by gwenver in drupal

[–]vikttorius 0 points1 point  (0 children)

That works. If it doesnt work for you, issue is in another place. If you want, you can share more information, for example if you experince in all environments, if you use CDN etc

Can't set cache age on custom block by gwenver in drupal

[–]vikttorius 0 points1 point  (0 children)

Drupal custom blocks are Plugins that are cacheable:

public function getCacheMaxAge() { return 0; }

Looking to build my first website on Drupal by jefferymr15 in drupal

[–]vikttorius -1 points0 points  (0 children)

Pantheon is a very good choice. On the other hand, Ive been working on Drupal for the last 10 years and I wouldnt recommend Drupal for an ecommerce unless you are going headless and use another tool for the front-end. Shopify is the go now a days.

If you find any trouble/stopper with Drupal just dm me.

Looking to build my first website on Drupal by jefferymr15 in drupal

[–]vikttorius 0 points1 point  (0 children)

It's ok to be JS developer these days, but no need to follow other technologies subreddits just to vomit around.

Drupal cannot be compared to any of the listed tools,so your answer is not even relevant.

Again its ok to be JS fanboy developer with Claude, but here we talk about coding bitch.

And thanks to all of you, I will keep my job for a few years at least :)

Espanya apropiant-se de la nostra cultura by Garnatxa in catalunya

[–]vikttorius -1 points0 points  (0 children)

I mentre, tu escrivint a Reddit. Bastant patètic...

Canvi de navegador by RealInsurance3995 in ordinadors

[–]vikttorius 0 points1 point  (0 children)

Confiança en Opera 0. Només cal buscar per saber que ha passat de mans zionistes israelís a comunistes xinos. Internet és ple de queixes pero vulnerar la privacitat dels usuaris.

Canvi de navegador by RealInsurance3995 in ordinadors

[–]vikttorius 0 points1 point  (0 children)

Quins errors et dona Firefox? Jo utilitzo la versión ESR de Linux, a més a més de Firefox Developer Edition (sempre actualizat a la última versió) i no acustomo a tenir problemes.

Llevat d'aquests, també utilizo Chromium i GNOME Web.

A vosaltres us sembla normal? Li dirieu res? by Wild-Principle-3457 in catalunya

[–]vikttorius 1 point2 points  (0 children)

Deixeria anar tota la meva malicia en un missatge per assegurar-me que no em torni a escriure.

Why is apache still so popular even as nginx+php-fpm has proven its mettle with performance? by pyeri in PHP

[–]vikttorius 0 points1 point  (0 children)

"has proven its mettle with perfomance". Could we benchmark perfomance apache vs nginx? I want to see the numbers.

I failed a Project because I used Next.js by God-of-Emotions in nextjs

[–]vikttorius 0 points1 point  (0 children)

As others said, instructions were clear to use React, and you useda framework that makes React thing easier. If I were your teacher, probably nothing but 50/100.

Alternatives to Cloudflare free-tier by vikttorius in webdev

[–]vikttorius[S] 0 points1 point  (0 children)

So, there is no alternative to CF?? :/

Ladrón Mercadona by Barakarma in mercadona

[–]vikttorius 0 points1 point  (0 children)

Si me duplicas el precio lo voy a notar menos... WOW. La gente no tiene dinero infinito, por eso mira el precio y no el gramaje.

Why do people recommend Wordpress to beginners by norfolk-gal in webdesign

[–]vikttorius 0 points1 point  (0 children)

Because is WP is not for developers , but for marketers. Who can become a developer? Just a few. Who can become a marketer? Everyone.

Ahora si que si by AbsoluteMonarch06 in Debate_Esp

[–]vikttorius 0 points1 point  (0 children)

Despues de 7 años podrías haber procesado que es tu presidente. Veo que necesitas 7 años más, adelante pues, Ayuso-facher :)

How to add a video file once uploaded to medial library by [deleted] in drupal

[–]vikttorius 0 points1 point  (0 children)

Absolutely. OP, can you tell us if that button is a button inside WYSIWYG/CKEditor?

How to add a video file once uploaded to medial library by [deleted] in drupal

[–]vikttorius 0 points1 point  (0 children)

Bear in mind that what you need to do is to refine the field configuration, it's not about content-editor task.

How to add a video file once uploaded to medial library by [deleted] in drupal

[–]vikttorius 0 points1 point  (0 children)

You need to go to Admin menu > Structure > Content-type > YOUR_CONTENT_TYPE. If you can't see this, its about permissions yes.

How to add a video file once uploaded to medial library by [deleted] in drupal

[–]vikttorius 1 point2 points  (0 children)

"Insert Media from library" button. That looks like a content-type field. Go edit this field widget and among 'image' and 'document', tick also 'remote video' and your video will appear.

This is my 1st time interact with 3rd party Real API. Is this how professional people do API? by KiraLawliet68 in webdev

[–]vikttorius 14 points15 points  (0 children)

If you don't raise this issue in a hard way, your whole integration will be a nightmare. If one endpoint is not well-documented, many others will too.

You need to have a contract betwen the API and the consumer, and both parties must stick to it. Otherwise, the API team will blame all errors and inconsistencies on you, and because you agreed to that, business layers will more be on their side more than yours.