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

fix {depcache,init,1,[{file,\"src/depcache.erl\"},{line,758}] #19

Merged
merged 1 commit into from
May 10, 2023
Merged

fix {depcache,init,1,[{file,\"src/depcache.erl\"},{line,758}] #19

merged 1 commit into from
May 10, 2023

Conversation

leeyisoft
Copy link

When I did this, the program reported an error:

    depcache:start_link(
        ?DEPCACHE_SERVER,
        #{
            memory_max => proplists:get_value(depcache_memory_max, Args)
            , callback => {?MODULE, record_depcache_event, [Args]}
        }
    ).

error:

fix {depcache,init,1,[{file,\"src/depcache.erl\"},{line,758}]

I'm not sure how to design this method record_depcache_event

Previously it was one parameter, now the latest code is two parameters

https://github.com/zotonic/zotonic/blob/master/apps/zotonic_core/src/support/z_depcache.erl

@mworrell
Copy link
Member

Good catch, that seems to have been an oversight when the option to use maps for the config was added.

@mworrell
Copy link
Member

mworrell commented May 10, 2023

For the callback, the MFA is called as:

M:F({eviction, Name} | A).

That is the type {Event, Name} is added in front of the Args supplied in the callback option.

So the usual callback options would be: {Module, Function, []}
Unless you want to pass something extra: {Module, Function, [extrarg1, extrarg2]}

@mworrell mworrell merged commit 82e17e5 into zotonic:master May 10, 2023
@mworrell
Copy link
Member

Thanks!

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.

2 participants